954,541 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

need help for java chat application

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

pawan_1983
Newbie Poster
10 posts since Oct 2007
Reputation Points: 10
Solved Threads: 0
 

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

hussulinux
Light Poster
42 posts since Feb 2007
Reputation Points: 10
Solved Threads: 2
 

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

masijade
Industrious Poster
Moderator
4,253 posts since Feb 2006
Reputation Points: 1,471
Solved Threads: 494
 

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.

Phaelax
Practically a Posting Shark
858 posts since Mar 2004
Reputation Points: 92
Solved Threads: 51
 

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

pawan_1983
Newbie Poster
10 posts since Oct 2007
Reputation Points: 10
Solved Threads: 0
 

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.

masijade
Industrious Poster
Moderator
4,253 posts since Feb 2006
Reputation Points: 1,471
Solved Threads: 494
 

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.

pawan_1983
Newbie Poster
10 posts since Oct 2007
Reputation Points: 10
Solved Threads: 0
 

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

masijade
Industrious Poster
Moderator
4,253 posts since Feb 2006
Reputation Points: 1,471
Solved Threads: 494
 

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.

orko
Junior Poster
164 posts since Apr 2006
Reputation Points: 46
Solved Threads: 11
 

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.

pawan_1983
Newbie Poster
10 posts since Oct 2007
Reputation Points: 10
Solved Threads: 0
 

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

Phaelax
Practically a Posting Shark
858 posts since Mar 2004
Reputation Points: 92
Solved Threads: 51
 

yes send me the idea to make this
thanks
Client to client as in without a centralized server like AIM's direct connection?

pawan_1983
Newbie Poster
10 posts since Oct 2007
Reputation Points: 10
Solved Threads: 0
 

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.

masijade
Industrious Poster
Moderator
4,253 posts since Feb 2006
Reputation Points: 1,471
Solved Threads: 494
 

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.
pawan_1983
Newbie Poster
10 posts since Oct 2007
Reputation Points: 10
Solved Threads: 0
 

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.

jwenting
duckman
Team Colleague
8,392 posts since Nov 2004
Reputation Points: 1,662
Solved Threads: 337
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You