Solved

Server thread manupulation

Posted on 2004-04-28
3
169 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Upgrade code from VS 2010 to VS 2015 7 45
C# Service FileSystemwatcher isse 9 65
C# DateTime Help 6 47
Run software updates from the website 6 50
In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…

759 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