Solved

Server thread manupulation

Posted on 2004-04-28
3
165 Views
Last Modified: 2010-04-15
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?
0
Comment
Question by:Code_mechanic
3 Comments
 
LVL 37

Accepted Solution

by:
gregoryyoung earned 25 total points
ID: 10940565
you set a flag for shutdown ... give threads some period of time (reasonable lets say 15 seconds) to finish their current operations if they all havnt finished and gone to the lan of the dead at this point you start killing them.
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Windows phone Development 11 29
ConsoleSql 1 18
Performance  Html.BeginForm vs jQuery 3 15
COnsume rest client 6 12
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now