JAVA 端口

2021/7/25 17:07:57

本文主要是介绍JAVA 端口,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

JAVA的端口

公有端口:0~1023

HTTP:80

HTTPS:443

FTP:21

Telent:23

程序注册端口:1024~49151

tomcat:8080

mysql:3306

orcal:1521

动态或自由端口:49152~65535

package 端口;

import java.net.InetSocketAddress;

public class TestInetSocketAddress {
    public static void main(String[] args) {
        InetSocketAddress inetSocketAddress = new InetSocketAddress("localhost", 443);
        System.out.println(inetSocketAddress);
        System.out.println(inetSocketAddress.getAddress());
        System.out.println(inetSocketAddress.getHostName());
        System.out.println(inetSocketAddress.getPort());
        System.out.println(inetSocketAddress.getHostString());
    }
}

 



这篇关于JAVA 端口的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程