Problem with Windows Service.

  • Thread starter Thread starter ruben barzallo via .NET 247
  • Start date Start date
R

ruben barzallo via .NET 247

(Type your message here)
Hi,
I have a Windows Service and works very good.
This "service" use a TcpListener.
Everything ok.

But, when the event is executed stop, the program must close the TcpListener connection, but then the application remains inhibited when executing this command. As it can be the problem?

Thanks
 
Try spawning the TCPListener in another thread when the service starts. Then when the service is stopped, terminate the thread. One way to do this is to have the service and thread both looking at a property in a static class. When the service is stopped set the property and wait on the listener thread to exit itself. Then exit the service application.
 
Back
Top