Using request.getRemoteAddr() returns 0:0:0:0:0:0:0:1

前端 未结 3 738
挽巷
挽巷 2020-12-13 06:17

I am trying to print the IP adress of the logged user in my webApplication. If a user connects from another PC (which is under the same network, as the web application is ru

3条回答
  •  甜味超标
    2020-12-13 06:20

    As we move over to IPv6 from IPv4, they are changing the loopback address (localhost) to 0:0:0:0:0:0:0:1 from 127.0.0.1 thats why you are getting this address.

    As for the functions:

    • getRemoteAddr() returns the clients IP

    • getLocalAddr() returns the IP of the server the application is running on

提交回复
热议问题