This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Java in General and the fly likes Chat Application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Chat Application" Watch "Chat Application" New topic
Author

Chat Application

chander shivdasani
Ranch Hand

Joined: Oct 09, 2007
Posts: 206

I am writing a chat application involving one server and multiple clients. However, when clients chat, the messages should not pass through server.
This is what i intend to do:

> Send chat request to server
> Server replies with credientials(IP,Port) of the other client
> Establish a connection with other client and proceed with the chat.

I am facing a problem in the 3rd step. I dont know how to establish a connection between client and another client?.
For establishing a connection between client and server i have used socket and server sockets. What is the way of establishing connection between client and another client?


Enjoy, Chander
SCJP 5, Oracle Certified PL/SQL Developer
Lorand Komaromi
Ranch Hand

Joined: Oct 08, 2009
Posts: 276
The clients will have to listen for incoming connections, just like your server...


OCJP 6 (93%)
chander shivdasani
Ranch Hand

Joined: Oct 09, 2007
Posts: 206

Does that mean each client will also have a server socket associated with it?
Lorand Komaromi
Ranch Hand

Joined: Oct 08, 2009
Posts: 276
chander shivdasani wrote:Does that mean each client will also have a server socket associated with it?


Yes.
 
 
subject: Chat Application