[hotjoe.com] HotJoe Java Help Forums
  [Search] Search   [Recent Topics] Recent Topics   [Hottest Topics] Hottest Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Visit java.com
Please send email if you are having login problems - see the posts below for more info.
Hotmail and Yahoo! users - please see the Hotmail post or the Yahoo! post for information on lost emails.
TCP/IP CLient-Server Chat Program  XML
Forum Index » Java Programming
Author Message
thornt5748

Newbie

Joined: 10/14/2011 16:28:57
Messages: 5
Offline

Hi Guys,

I'm quite new here and am new to Java Programming, but i could use some help. I have a client-serve chat program and have almost finished it to my standards however I am trying to enable the server to accept multiple clients, how would i do this? what do i have to add or change on the server to allow this?

Thanks

Server
stdunbar

Newbie
[Avatar]

Joined: 06/22/2005 14:51:37
Messages: 855
Location: Superior, CO, USA
Offline

Remember that when you accept() a connection you communicate on that Socket, not the ServerSocket. So the traditional way is to have a thread to handle each client. I started a how to on this years ago - I should finish it but basically you'll spawn a thread for each clientSocket and handle the client that way. The thread can live as long as your protocol wants - usually for the life of the conversation.


Thanks for using the forums at hotjoe.com
[WWW] [Yahoo!] [ICQ]
thornt5748

Newbie

Joined: 10/14/2011 16:28:57
Messages: 5
Offline

First things, thank you for your reply, secondly how would I do this? What would the coding be?

Thanks
 
Forum Index » Java Programming
Go to:   
Powered by JForum 2.1.9 © JForum Team
This site run by Scott Dunbar of Xigole Systems. © 2005-2011 - Scott Dunbar
Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners
hotjoe.com, xigole.com, and Scott Dunbar have no affiliation with Oracle