• Post Reply Bookmark Topic Watch Topic
  • New Topic

How do i limit the number of socket connections...  RSS feed

 
Stoic Eustov
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a file server that accepts connections, i would like to limit the number of connections to 45 users...
The �ServerSocket (int port, int backlog)�, does not work due to OS buffers...
Anybody know how to limit the number of connections, then free the connection upon user disconnect. Thx
 
Lewin Chan
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why don't you make a threadpool of 45 request handlers, and just notify them when there is a new request.
I think the o'reilly book Java Network Programming has a pretty good example of doing this.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!