The below code is supposed to work like this; if a client connects, start a new thread, repeat forever (ie, do this everytime a client connects).
Does this do what I think it's supposed to do? At the moment I can't test it properly, all I need to know is: when a client connects and the server starts a new thread will this then continue to wait for connections from other clients (and start new threads when they do connect) or will it wait until the thread has stopped running then wait for another client to connect?
Yes, that's the basic structure for almost every server. If you'll have lots of connections over time the overhead of creating new threads for each client connection can add up. In JDK 5 look into thread pooling, start with Executor in the JavaDoc. Here's one of mine:
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
sunglasses are a type of coolness prosthetic. Check out the sunglasses on this tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss