Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TcpListener - address in use

Status
Not open for further replies.

haddaway

Programmer
Jul 6, 2005
172
SE
I have an application which listens to a port. I have no problem connecting to it. When I close the application the address is free for use again. In one case the address is in use - it's when I have started a process (system.diagnostics) somewhere in the application and that process is still running. When I have done so, the tcplistener is not shutdown properly and the address is taken.

How can I force a shutdown of the tcplistener? Right now I am doing this but it does not help:

If Not listener Is Nothing Then
listener.Server.Close()
listener.Stop()
End If
 
Shutdown the System.Diagnostics process before you shut down the TCPListener.


I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson
 
Is there some other way? Why must the TcpListener be connected to a process. I would like to have the process still there but just shut down the listener.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top