How can I find out who is accessing my TCP server? I would be interested in logging the IP addresses of the clients.

Krzysztof Raciniewski

The client socket contains IP address. The lines below can help you:

Socket socket = new ServerSocket ().accept ();
System.out.println ("Client from " + socket.getInetAddress().getHostAddress());
0 Comments  (click to add your comment)
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.