以下实例演示了如何使用 net.Socket 类的 getInetAddress() 方法来连接到指定主机:
Main.java 文件
以上代码运行输出结果为:
连接到 http:/www.runoob.com/222.73.134.120