大数据平台需要对访问量进行统计,则我们通过对IP请求头的记录实现 Java.net实现Java的网络功能 如果检测为127.0.0.1,则为本机ip,此时读取本机的网卡 if (ipAddress.equals("127.0.0.1")) { InetAddress inet = null; try { inet = InetAddress.getLocalHost(); } catch (UnknownHostException e) { e.printStackTrace();