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的更多相关文章
随机推荐
- OO第一单元作业总结之初识面向对象
第一个单元的三次作业均为求导,循序渐进的让我们掌握如何构造类和方法,让整个代码是面向对象的设计而不是面向过程的设计.如果第一次作业和第二次作业你只是简单的对过程着手架构类,到了第三次作业就会变得格外麻 ...
- sprindmvc
Spring Web MVC是一种基于Java的实现了Web MVC设计模式的请求驱动类型的轻量级Web框架,即使用了MVC架构模式的思想,将web层进行职责解耦,基于请求驱动指的就是使用请求-响应模 ...
- day 23 对象的名称空间 类,对象属性和方法 封装 接口提供
一.对象的特有名称空间 # 对象独有的名称空间:在产生对象时就赋初值 '''class ted: def func(): 当func里不存在参数时,调用时不需要给值 print('hah')ted.f ...
- L347
Even Educators Believe These 7 Myths About Learning1. Individuals learn better when they receive inf ...
- fiddler模拟弱网测试点
弱网: oSession[“request-trickle-delay”] = “300”; 注释的也很明白,Delay sends by 300ms per KB uploaded.上传1KB需要3 ...
- js date setInterval 时间 时钟 getFullYear ,JavaScript
js 创建时钟: 1.参考链接: 注意 getYear (两位 或者 四位) 改成 getFullYear js操作时间 2.实例: html: <span class="glyp ...
- java发送soapui格式的报文
import java.io.*;import java.net.HttpURLConnection;import java.net.URL; 使用java对soapui报文进行发送 public c ...
- 更改Windows更新源(解决公司内部网络无法下载语言包或更新的问题)
打开注册表 找到HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate 将WUServer.WUStatusServe ...
- 使用Axure做验证码之校验验证码(二)
本次作业,输入验证码,并校验验证码是否正确.上篇文章,介绍了如何获取验证码,本次作业在上次作业的基础上,做进一步的深究. 1.在上次作业中,增加新的元件: 文本框,命名:输入验证码: 增加热区,命名为 ...
- WEB学习笔记5-标准的HTML页面结构
完整的文档包含一下 <html> <head> </head> <body> </body> </html> 在HTML5规范中 ...