1、
//获取本机ip地址
InetAddress addr = InetAddress.getLocalHost();
String ip=addr.getHostAddress().toString(); //ip:192.168.0.104
String iptest = request.getLocalAddr(); //ip:0:0:0:0:0:0:0:1
2、
获得端口号:
int port = request.getLocalPort() //8080