Hello,
I am currently testing a program which runs a server thread that listens on a port and launch the thread of services for customers. I have this code
Code:
while (! end) {
clsoc = sersoc.accept();
Thread clthr = new Thread(new ServiceBiblio(
serverAddress, clsoc, g));
clthr.home();
end = stopThread;
}
I found a stop function on internet and I used it in my code, here it is
Code:
Public synchronized void stop() {
this.stopThread = true;
}
My problem is if I want to stop the server while it is listening, it does not work, it is not normal browsing loop. I do not see how to stop the server properly, I tried a violent serverSocket.close (), but this stops the main program too. If you have any more methods to do the same then do post back.
Bookmarks