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

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-06-03
  • 2022-02-04
  • 2022-12-23
猜你喜欢
  • 2021-12-15
  • 2021-12-19
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案