How to find the IP Address of Client connected to Server?

前端 未结 4 1568
傲寒
傲寒 2020-12-13 18:38

My client pc is connected to as server pc via sockets over Ethernet, How do I find the IP of this client from the server side code.
The server is dishing out one socket

4条回答
  •  萌比男神i
    2020-12-13 19:22

    I believe you want to use the remote address instead:

    csocket.getRemoteSocketAddress().toString();
    

提交回复
热议问题