用servlet获取IP等信息

Posted ConfidentLiu

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了用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();//获取远程计算机的名字  

以上是关于用servlet获取IP等信息的主要内容,如果未能解决你的问题,请参考以下文章