Use Socket.getInetAddress().getAddress() to return the 4 byte IP address. Use it on the Socket object that comes from ServerSocket.accept(), don't be confused by ServerSocket.getInetAdress(), which should return the address of your local server. If you were looking to allow only IP addresses from within a particular sub-net, you could then AND these 4 bytes with the sub-net mask, and see if ...