java8_api_net
网络编程1
操作ip地址
核心类 InetAddress
相关方法 getByName,getAllByName,getLocalHost
操作socket地址
由ip地址(或主机名)与端口号组成
核心类 InetSocketAddress
相关方法
package java_20180213_api_net; import java.net.InetAddress;
import java.net.InetSocketAddress; public class InetAddressDemo { public static void main(String[] args) throws Exception {
// InetAddress ia=InetAddress.getLocalHost();
// System.out.println(ia.getHostName());
// System.out.println(ia.getHostAddress()); InetAddress[] ia1=InetAddress.getAllByName("DESKTOP-NMUHAH0");
for (InetAddress inetAddress : ia1) {
System.out.println(inetAddress.getHostAddress());
}
InetAddress ia2=InetAddress.getByName("edu.51cto.com");
System.out.println("edu: "+ia2.getHostAddress()); InetSocketAddress ia3=new InetSocketAddress(80);
}
}
网络编程2
uri,url,urn的概念
java中相关的类
java.net.URI
java.net.URL
java.net.URLEncoder
java.net.URLDecoder
网络编程3
通过java api访问url的内容
网络编程4
实现tcp服务器端socket
实现tcp客户端socket
java8_api_net的更多相关文章
随机推荐
- Windows挂载NFS共享盘
Centos7添加NFS方法请见如下链接: https://www.cnblogs.com/jackyzm/p/10285845.html 一:添加NFS服务 1.1:此电脑-右键-管理-window ...
- 对弈的C++学习笔记
2018-07-11上传 一:从C到C++ 1.C++新类型 bool 判断真假 占用一个字节 if(条件) 真1或者假 0 bool 类型的取值 true false ...
- Thymeleaf中href与 th:href的区别
语法格式如下: <a th:href="@{/channel/page/add}">添加渠道 </a> <a href="/channel/ ...
- nginx——配置 Nginx 错误页面优雅显示
...... http { location / { root html/www; index index.html index.htm; error_page 400 401 402 403 404 ...
- mssqlserver超级班助类 带详细用法
using System; using System.Collections; using System.Collections.Generic; using System.Configuration ...
- JAVA8之数据流Stream
在JAVA8之前的传统编程方式,如果我们需要操作一个集合数据,需要使用集合提供的API,通过一个循环去获取集合的元素,这种访问数据的方式会使代码显得臃肿,JAVA8新引入的Stream类,用于重新封装 ...
- 在Linux服务器上使用Vbox安装虚拟机
先去官网(www.virtualbox.org)上下载对应Linux系统的Vbox版本. 我这边用的是Oracle Linux 7系统(KDE安装) 使用rpm安装virtualbox 发现报错,按照 ...
- [JsonSchema] 关于接口测试 Json 格式比对核心算法实现 (Java 版)
引言 为什么要自己重新造轮子,而不是采用第三方的JsonSchema方法进行实现存在以下痛点:1.我之前在网上找了很久,没有找到java版直接进行jsonschema生成的方法或直接比较的方法2.ht ...
- MVC(Model -View-Controller)实例应用模式
MVC(Model -View-Controller)实例应用模式 以登录为例: Model:User package com.keith.bean; public class TUser imple ...
- 《Spring实战》读书笔记——Spring简介
欢迎大家关注我的微信公众号,共同交流Java相关技术! 使用Spring的目的 Spring是为了解决企业级应用开发的复杂性而创建的,使用Spring可以让简单的JavaBean实现之前只有EJB才能 ...