时间:2020-10-12 09:32:19 | 栏目:JSP代码 | 点击:次
如下所示:
InetAddress addr = InetAddress.getLocalHost();
String ip = addr.getHostAddress().toString();//获得本机IP
//访问的server的ip是:System.out.println("访问的ip是:" + ip);
//访问者的ip是:System.out.println("ip是:" + request.getRemoteAddr());