端口port

package edu.wtbu;

import java.net.InetSocketAddress;

/*
端口:表示计算机上一个程序的进程
1.不同的进程有不同的端口号,用来区分软件
2.被规定:0~65535
3.TCP,UDP:65535*2,单个协议下,端口号不能冲突
4.端口分类:
公有端口:0~1023
HTPP:80
HTPPS:443
FTP:21
Telent:23
程序注册端口:1024~49151,分配用户或者程序
Tomcat:8080
Mysql:3306
Oracle:1521
动态,私有:49152~65525
netstat -ano 查看所有端口
netstat -ano|findstr "5900" 查看指定的端口
tasklist|findstr "14540"
打开任务管理器:Ctrl+shift+Esc或者Ctrl+Alt+del
*/
public class Demo01 {
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(inetSocketAddress1.getAddress());
System.out.println(inetSocketAddress1.getHostName());
System.out.println(inetSocketAddress1.getPort());
}
}
posted @   惊鸿宴远赴人间  阅读(28)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
点击右上角即可分享
微信分享提示