Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Pool of socket connections

 
Uma Viswanathan
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The server is multi-threaded.
Instead of creating a socket connection for each request, i want to maintain a pool of socket connections? If one client has done with its work, then i want to restore the connection and use for another client.
Could someone explain me how to do pool of socket connections?
Thanks a lot.
 
aditya mahajan
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
why do you want to do something like this. The system will itself allocate the empty ports to the new clients and when a client disconnects the port that it was connected to becomes free
So you do not have to explicitely maintain a pool of ports
Originally posted by Uma Viswanathan:
The server is multi-threaded.
Instead of creating a socket connection for each request, i want to maintain a pool of socket connections? If one client has done with its work, then i want to restore the connection and use for another client.
Could someone explain me how to do pool of socket connections?
Thanks a lot.

 
parul patidar
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i dont think u need to create a new connection for each request
it is needed in URLConnection not socket connection
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic