question about stopping a process

Hello all, I have a Server class that allows connections on a certain port. I have a Connection class that handles input/etc. from the user once they are connected. I have it so that if a user types "shutdown" it will shutdown the Server. Here is the code for the main game loop. shutDown is a boolean, which is set to true when the user types "shutdown". My problem is that sometimes it takes more than 1 try before the server will actually shut down. Is there a way to force the gameLoop to check the status of shutDown when the Connection class is updated?

publicstaticvoid gameLoop()

{

while (!shutDown)

{

try{

new Connection(s, server.accept()).start();

}catch (IOException ioe){}

}

}

[1194 byte] By [dub_styleea] at [2007-11-27 11:14:53]
# 1

In your current posted code, we don't see the principal faulty logic that would generate the problem you describe. Who is the 'user' -- server operator or a client? What is 's' in Connection(s, server.accept()).start()? There are so many things unknown to us.

Post a small demo code that is generally compilable, runnable and could reproduce your problem. See: http://homepage1.nifty.com/algafield/sscce.html and http://www.yoda.arachsys.com/java/newsgroups.html

hiwaa at 2007-7-29 14:09:36 > top of Java-index,Java Essentials,New To Java...