我想构建一个用户应用程序,它将通过 INET 套接字系列与内核部分进行交互。JAVA 是否支持 INET 套接字系列?
问问题
285 次
1 回答
2
是的,Java 支持 INET
我希望以下程序对您有所帮助
import java.net.*;
class InetAddressTest
{
public static void main(String args[]) throws
UnknownHostException {
InetAddress Address = InetAddress.getLocalHost();
System.out.println(Address);
Address = InetAddress.getByName("starwave.com");
System.out.println(Address);
InetAddress SW[] = InetAddress.getAllByName("www.nba.com");
for (int i=0; i<SW.length; i++)
System.out.println(SW[i]);
}
}
于 2011-10-18T06:52:00.830 回答