标签:编程 网络 System println InetAddress getByName com out
1.1 计算机网络
1.2 网络通信的要素
1.3 ip
常用方法部分了解
package com.kuang.lesson01;
import java.net.InetAddress;
import java.net.UnknownHostException;
//测试IP
public class TestInetAddress {
public static void main(String[] args) {
try {
//InetAddress里面没有构造器和字段,所以不能new 只能通过静态方法返回过来
InetAddress inetAddress1 = InetAddress.getByName("127.0.0.1");
System.out.println(inetAddress1);
InetAddress inetAddress2 = InetAddress.getByName("localhost");//不同方式获得本机ip
System.out.println(inetAddress2);
InetAddress inetAddress3 = InetAddress.getLocalHost();
System.out.println(inetAddress3);
//查询网站ip地址
InetAddress inetAddress4 = InetAddress.getByName("www.baidu.com");
System.out.println(inetAddress4);
} catch (UnknownHostException e) {
e.printStackTrace();
}
}
}
/127.0.0.1
localhost/127.0.0.1
DESKTOP-2GITFTM/192.168.3.30
www.baidu.com/110.242.68.3
1.4 端口Port
1.5 通信协议
计算机之间如何交流
网络通信协议:针对网络产生一种协议
1.6 TCP实现聊天
1.6.1 TCP文件上传
1.7 UDP
1.7.1 UDP消息发送
被挡住那里是接收数据包
1.7.2 UDP聊天室
标签:编程,网络,System,println,InetAddress,getByName,com,out 来源: https://blog.csdn.net/m0_48219937/article/details/119387519
本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享; 2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关; 3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关; 4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除; 5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。