first register all ur client with the server.
for a very basic application maintain a list in arraylist.
then when a new user logs in, send this arraylist to him and he'll get the list of users online
for an old user, send this list to the connected user at intervals of say 1 sec.
when a user is logged out, remove that user from the list...