国产chinesehdxxxx野外,国产av无码专区亚洲av琪琪,播放男人添女人下边视频,成人国产精品一区二区免费看,chinese丰满人妻videos

InetSocketAddress

2019-07-09 22:33 更新

InetSocketAddress測(cè)試: 解決端口問題。

import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.UnknownHostException;


public class Test {
    public static void main(String[] args) throws UnknownHostException {
        /**
         * 封裝端口:在InetAddress基礎(chǔ)上+端口。
         */
        //127.0.0.1代表本機(jī),相當(dāng)于localhost。
        InetSocketAddress address = new InetSocketAddress("127.0.0.1", 9999);
        /**
         * new InetSocketAddress("127.0.0.1", 9999);內(nèi)部調(diào)用了
         * new InetSocketAddress(InetAddress.getByName("127.0.0.1"), 9999);
         * 即進(jìn)行了封裝。
         */
//      address = new InetSocketAddress(InetAddress.getByName("127.0.0.1"), 9999);
        System.out.println(address.getHostName());
        System.out.println(address.getPort());
        InetAddress inetAddress = address.getAddress();
        System.out.println(inetAddress.getHostAddress());
        System.out.println(inetAddress.getHostName());

        
    }
}
以上內(nèi)容是否對(duì)您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號(hào)
微信公眾號(hào)

編程獅公眾號(hào)