|
Re: Confused about simple multi-threaded server
Im new to Java myself but i that changing the way you have threaded your server may be an idea.
For example you are spawning a new tread of the entire program. Perhaps you would be better of having the main class run an infinite loop accepting connection from clients. Once it has recieved a client from socket.accept() the you can pass that to a new Threaded class that deals with all of the input and outputs to that socket.
This may help to tidy up the server and make it clearer what is going on. Also it means that multiple clients can connect at the same time if you require this.
Cheers,
Chris
__________________
Who said i couldn't program
sarcasm = raw_input('Type in a sarcastic remark: ')
print sarcasm
|