This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Sockets and Internet Protocols and the fly likes Chat Programming. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Chat Programming." Watch "Chat Programming." New topic

Chat Programming.

Ransika deSilva
Ranch Hand

Joined: Feb 18, 2003
Posts: 524
I want to write a chat program where there are basically a server and many clients., I would be much appriciated if you guys give me some ideas,
Thank you very much.......

SCJP 1.4, SCMAD 1.0<br />SCWCD, SCBCD (in progress)
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
In high level terms consider this option. The Client and Server programs both open ServerSockets and act as clients to each other. If this is a bit confusing at first, do some simple tutorials on socket clients & servers, or find a friend and role-play the two machines.

Lots of moving parts, no? And I left out any way to log out. The client might tell the server it is logging out so the server can remove the client from the list of logged in clients. Or the server might try to connect to a client and fail, meaning the client is no longer running. That would be a sign to remove the client from the list of logged in clients, too.
Hope that helps!

A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Ransika deSilva
Ranch Hand

Joined: Feb 18, 2003
Posts: 524
Hello all,
Thank you very much for the reply. I did figure out how to do the task, It is interesting. I am enjoying the programming.
Thank you very much for helping.
I agree. Here's the link:
subject: Chat Programming.
It's not a secret anymore!