If you write applications that supply TCP services via the StreamSocket class, its extremely easy to determine the IP address and port of the remote connection. The accept method returns a Socket (which is used to communicate with the remote client). The Socket class has a getInetAddress(), and a getPort() method – all instances of socket can provide you with a unique identifier at a given point in time.

As far as finding out exactly who (as opposed to what machine) is connected to your server, you might want to have some form of authentication phase so that as a client connects, you can uniquely identify the user. If you create a lookup table, at a later stage you can lookup the IP address and port to determine the user.

Posted in: Java

Related FAQ's

Marius Ion ANGEL HOT SOFT LLC (800) 316-7677