-
获取 ip 地址
- StringBuilder IFCONFIG=new StringBuilder();
- try {
- for (Enumeration<NetworkInterface> en = NetworkInterface.getNetworkInterfaces(); en.hasMoreElements();) {
- NetworkInterface intf = en.nextElement();
- for (Enumeration<InetAddress> enumIpAddr = intf.getInetAddresses(); enumIpAddr.hasMoreElements();) {
- InetAddress inetAddress = enumIpAddr.nextElement();
- if (!inetAddress.isLoopbackAddress() && !inetAddress.isLinkLocalAddress() && inetAddress.isSiteLocalAddress()) {
- IFCONFIG.append(inetAddress.getHostAddress().toString()+"
");
- }
-
- }
- }
- } catch (SocketException ex) {
- }
- System.out.println(IFCONFIG);
-
相关阅读:
常用的正则表达式
Nginx反向代理
docker-day1-安装和基本使用
Nginx + Keepalived
Nginx源码安装
apache-实战(二)
apache-实战(一)
apache--配置文件属性介绍
软件目录结构规范
python常用模块(二)
-
原文地址:https://www.cnblogs.com/lxh520/p/7990500.html
Copyright © 2020-2023
润新知