Java NIO: Differentiating Clients

I'm currently messing around with some of the Java NIO features (sockets, socketChannels, selectionKeys, ect )

I currently have a server and client setup where the server can send information to multiple clients, and it works just fine.

The problem I'm having is that the server somehow knows which client is which and sends the right data to the right ones, but I haven't found out how _ I _ can keep track of the clients.

Optimally I'm going to want to have multiple clients interacting with other clients. Certain sets of clients will be sent certain info, and other sets other info. All I really need is a single piece of information that I can use to distinguish the clients with.

Thanks a ton everyone.

[744 byte] By [ReptileKing234a] at [2007-11-27 0:15:13]
# 1
If you use register(Selector sel, int ops, Object att) method for client channel registration, you could access attachment att from client's selection key. Attachment att can be anything including some client ID info.
hiwaa at 2007-7-11 22:01:50 > top of Java-index,Core,Core APIs...