端口表示计算机一个程序的进程。
- 不同的进程有不同的端口,端口号不能重复,用来区分软件
- 被规定 0-65535
- TCP UDP 各为65535, 两个类端口号可以相同
端口分类
- 公有端口 0-1023
--- HTTP 80
--- HTTPS 443
--- FTP 21
--- TELENT 23
- 程序注册端口 1014-49151 分配给用户和程序
--- tomcat 8080
--- MySql 3306
--- Oracle 1521
- 动态 私有 49152-65535
DOS命令:netstat - ano
netstat - an0 | findstr "8080"
快捷键:ctrl+Shift+Esc
package com.lr;
import java.net.InetSocketAddress;
public class testSocketDemo {
public static void main(String[] args) {
InetSocketAddress inetSocketAddress1 = new InetSocketAddress("127.0.0.1",8080);
InetSocketAddress inetSocketAddress2 = new InetSocketAddress("localhost",8080);
System.out.println(inetSocketAddress1);
System.out.println(inetSocketAddress2);
System.out.println(inetSocketAddress2.getPort());
System.out.println(inetSocketAddress2.getAddress());
}
}
标签:1.4,12,14,端口,System,---,println,InetSocketAddress,out From: https://www.cnblogs.com/RUI2022/p/16983473.html