using C# here (.NET 2.0)

right, no idea how on earth i managed it with my other application, written in .NET 1.1 but this is a totally new app.

OK, i have a simple port listening service.

I can stop the service and start it, with a click of a button. All good!
I can also do this when the client connected says to the server to disconnect. The service will then be restarted. cool!

since the port listener will be executed in a new thread in the application (server), I will have these issues:

1) client could prematurely exit (such as a power outage or whatever) - server picks this up, I then want to abort the thread and restart the service. Sometimes this works.

When it works, if I then press "stop service" on the server, it appears to do so but for some reason when i press start service, it does so but it does not seem to listen to incoming communication.... no idea why.

it's tricky to explain so I would like to have your ideas on what is the best approach to abort a thread and restart the port listening service.

thanks