用servlet获取IP等信息

  1. Locale languageType=request.getLocale();//获取用户语言  
  2. String localIp=request.getLocalAddr();//获取本地ip  
  3. int localPort=request.getLocalPort();//获取本地的端口  
  4. String localName=request.getLocalName();//获取本地计算机的名字  
  5. String remoteIp=request.getRemoteAddr();//获取客户端的ip  
  6. int remotePort=request.getRemotePort();//获取客户端的端口号  
  7. String serverName=request.getRemoteHost();//获取远程计算机的名字  

猜你喜欢

转载自www.cnblogs.com/ConfidentLiu/p/9144546.html