i am creating chat application .can anybody tell me how can i know who is on line on the server and how can i communicate with on line members.

thanks for help

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...

i am creating chat application .can anybody tell me how can i know who is on line on the server and how can i communicate with on line members.

thanks for help

In Other Words: "How do I write a Chat Application?" since the two posted "questions" is pretty much exactly what a chat application is, and possibly implying "Write a Chat Application for me."

A google search for java chat application will return tons of useful results. Then if you get stuck on something more specific, let us know.

sir
tell me in detail.i am not rich in java
if possible send me some code for that
thanx

It makes no difference whatsoever if you are "rich in java" or not (at least for the first two steps). Sit down and think about what a chat application needs to do, in detail, without any consideration, whatsoever about which programming language might be used.

Once you have figured out what it needs to do, sit down and break these requirements up into "working groups" (i.e. modules) of related functions.

Then you can sit down and start searching through API docs/tutorials/Google for the Java methods you need to implement these functions (hopefully you know at least basic Java, i.e. how to define a class and the varying protection/access modifiers, etc, etc).

Then you can actually start coding. When, at this point, you have a specific question, come back and ask. But we are not going to do any of this work for you. We may nudge you in the right direction from time to time, when you ask (as this response is doing), but we are definately not going to "give you teh codez".

And stop spamming with personal messages. Keep the discussion here so everyone can benefit from it.

sir
i already created a simple chat server .clients can chat with this as a room .how can i communicate between two client from connection pool.

If you are using a server based chat (rather than an everybody to everybody, i.e. with multicast or whatever), then, obviously, you need to have the server accept the message, than send it out to all connected clients. What do you not understand there?

Edit: And, BTW, this

i already created a simple chat server

is not what you said. It would have been extremely advisable to include this sort of information in your first post. That would have definately prevented my last post (which seemd to irk you a bit, admit it). But, like they say, ask a stupid question .....

ha ha... interesting thing... i also agree, u shud have said abt exactly wat u need to know... besides i have some more question... what kind of server u r using? is it irc? or some thing else?... u said ppl can chat in a room... so does it mean they really don't know who else are in the room?... plz explain briefly wat ur chat server is doing... otherwise, itz difficult to guess.

sir
i am using tomcat .first i create a server socket and this ss takes message from clients and send back to all clients(that is just like a chat room).
now i want to make client to client communication for private message and yes they dont know who else in the room.

ha ha... interesting thing... i also agree, u shud have said abt exactly wat u need to know... besides i have some more question... what kind of server u r using? is it irc? or some thing else?... u said ppl can chat in a room... so does it mean they really don't know who else are in the room?... plz explain briefly wat ur chat server is doing... otherwise, itz difficult to guess.

yes send me the idea to make this
thanks

Client to client as in without a centralized server like AIM's direct connection?

You will need a repoduction of a large part of your server code, in your clients, if you really want a direct connection, of course. Then there is also the problem of firewalls, routers, ISP, and any number of other things. Your best bet is to still leave it run over the server, just design some protocol hook in your design that restricts those messages to individual clients, rather than having the server broadcast it to everyone.

i want to create users list and send it to all client just like yahoochat or others.
how can i create it .help me

You will need a repoduction of a large part of your server code, in your clients, if you really want a direct connection, of course. Then there is also the problem of firewalls, routers, ISP, and any number of other things. Your best bet is to still leave it run over the server, just design some protocol hook in your design that restricts those messages to individual clients, rather than having the server broadcast it to everyone.

same way you create any other list.

If you don't have such a list yet it clearly indicates that you did not in fact create that server yet.
So that statement was a trick to try to get someone to do your work for you and write you a client. At which point the server would magically "not work" and could someone please write a new one to work with the client.

This article has been dead for over six months. Start a new discussion instead.