I m writing up a time server which communicates with clients via TCP/IP asynchronously.The listener itself runs on a thread spawned during initialisation. It listens on host at specified port for incoming connections and each client is served on a separate individual thread(i.e asynch op). The GUI allows the user to disconnect clients at any given time, and the way i do this is by closing all open connections, then closing the listening socket and finally aborting the thread the server is running on. Afterwards, I spawn a fresh thread to restart the server process. When i kill the thread, i do get exceptions thrown by the events that are already setup for the connected clients, but they are caught inside the code. Is this a good way of addressing the problem, are there standard/better ways of dealing with such a scenario?
would there be any examples i could refer to?