Re: a multithreaded server
Posted By:
Robert_Lybarger
Posted On:
Thursday, April 6, 2006 07:55 PM
I'm not clear about a few things (notably the 'threaded' nature of what you're doing, as 'SocketThread' isn't provided). That said, I would probably have a "SocketThreadManager" class (which runs in its own thread?) that has a way of determining how many SocketThreads are alive and doing useful work, and also provides a method that returns this number. When you "accept" from your ServerSocket object, have it poll this manager so it can determine whether to pass the client's connection to the manager or otherwise immediately tell the client to go away. Granted that leaves some implementation details up in the air for how the manager does its job correctly; hopefully this line of thought gives you a different direction to pursue.