InetAddress.getLocalHost()就是获得本机的IP,一点没错。
要获得远程主机的IP用getCodeBase函数。String hostName = this.getCodeBase().getHost();//this指Applet
String hostIP = InetAddress.getByName(hostName).getHostAddress();
要获得远程主机的IP用getCodeBase函数。String hostName = this.getCodeBase().getHost();//this指Applet
String hostIP = InetAddress.getByName(hostName).getHostAddress();
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货