Multiple Socket connection to a single Server??
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Shridhar_N
Posted On:   Sunday, December 8, 2002 10:26 PM

Hi All,

I wanto open multiple sockets with different listening port numbers in a single server? For each socket, the way i deal with the inputstream and outputstream is different.
Can anyone explain me how do i do that with a sample code.

Thankx in Advance..

Shridhar..

Re: Multiple Socket connection to a single Server??

Posted By:   Gautam_Marwaha  
Posted On:   Sunday, December 8, 2002 11:10 PM

For each port you want to listen to, open a ServerSocket and call accept() which will have them waiting for incoming requests. Ideally each shd handle incoming requests by spawning threads. Don't know what you mean by "single server" - what you want is many ServerSockets (or Servers) listening on different ports to service requests differently. Maybe what you mean is single jvm (starter java program) that starts off these ServerSockets...use different threads...
About | Sitemap | Contact