在Java中获取“外部”IP地址
public class IPAddress { private InetAddress thisIp; private String thisIpAddress; private void setIpAdd() { try { InetAddress thisIp = InetAddress.getLocalHost(); thisIpAddress = thisIp.getHostAddress().toString(); } catch (Exception e) { } } protected String getIpAddress() { setIpAdd(); return thisIpAddress; }}
相关分类