Reputation: 3678
I have a Windows service that listens for connections with
TcpClient client = myTcpListener.AcceptTcpClient();
I am wondering what happens when this Windows service is stopped while waiting to accept a new connection.
Will the listener still be listening for connections on that port? If so, how can I kill this listener?
Upvotes: 1
Views: 1146
Reputation: 39013
When the process dies, the listener will obviously not be listening anymore.
You should clean it up properly as mentioned by ChrisWue.
Upvotes: 0
Reputation: 183
It's the same behavior of a thread. The process only ends when threads finish. When you run the stop method, close all connections manually.
Upvotes: 0