端口port
端口port
-
端口: 计算机上的一个程序的进程;
-
不同的进程有不同的端口号!用来区分软件!
-
被规定 0 - 65535
-
TCP UDP : 65535*2 ,单个协议下,端口号不能冲突
-
端口分类(不建议占用)
-
公有端口0~1023
- HTTP : 80
- HTTPS : 443
- FTP : 21
- Telent :23
-
程序注册端口:1024~49151,分配用户或者程序
- Tomcat:8080
- MySQL:3306
- Oracle:1521
- IDEA : 63342
-
动态、私有:19452 ~ 65535
-
-
netstat -ano // 查看所以端口
netstat -ano|findstr "5900" // 查看制定端口
tasklist|findstr "xxxx" // 查看制定进程
public class TestPort {
public static void main(String[] args) {
InetSocketAddress inetSocketAddress = new InetSocketAddress("127.0.0.1", 80);
System.out.println(inetSocketAddress.getAddress());
System.out.println(inetSocketAddress.getHostName()); //地址
System.out.println(inetSocketAddress.getPort()); //端口
System.out.println(inetSocketAddress);
}
}

浙公网安备 33010602011771号