QUOTE(clatcho @ 3 Apr, 2008 - 08:42 AM)

How would you test to see if anything was actually connected to a serverSocket ?
I have a program that constantly listens for connections, a client will connect to it, do what it needs to do, but the server then waits for the next connection.
What i need to be able to do is say IF NOTHING IS CONNECTED then perform action ELSE perform other action
As 1lacca would say:
Dream.In.Code has a policy by which we prefer to see a good faith effort on your part before providing source code for homework assignments. Please post the code you have written in an effort to resolve the problem, and our members would be happy to provide some guidance. Be sure to include a description of any errors you are encountering as well.
Put your code between code tags.
But I guess we can go with pseudo code
Basically I don't think that
if(nothing is connected) {
do something
}
else {
do something else
}
is a good idea... you will loop an burn CPU time when nothing is connected
the real way is
for(;;) {
wait for connection
start a thread to handle the connection
}