提交 195c2453 编写于 作者: H haocao

Refactor ip utils.

上级 35048a0c
......@@ -41,6 +41,7 @@ public final class IpUtils {
* <p>
* 有限获取外网IP地址.
* 也有可能是链接着路由器的最终IP地址.
* 如果发生异常返回UnknownIP.
* </p>
*
* @return 本机IP地址
......@@ -53,7 +54,7 @@ public final class IpUtils {
try {
netInterfaces = NetworkInterface.getNetworkInterfaces();
} catch (final SocketException ex) {
throw new RuntimeException(ex);
return "UnknownIP";
}
String localIpAddress = null;
while (netInterfaces.hasMoreElements()) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册