how to close a socket?

bonedoc

Well-known member
Joined
May 4, 2006
Messages
112
Programming Experience
Beginner
I am getting the error when I try to open another instance of a socket...but I cant figure out how to terminate the old useage of it. Any ideas?

Here is how I created it:

Constant portNo as Integer = 500
Dim LocalAdd as System.Net.IPaddress = System.Net.Ipaddress.Parse("192.168.1.68")
Dim listener as New TcpListener(LocalAdd, portNo)
Listener.start


I cant seem to close it, even with listener.Stop
 
Starting a TcpListener doesn't open any sockets, only when an incomming TcpClient request is accepted is a socket connected.

Calling tcpclient.Close does not close the connection, to do that you must call Close on the NetworkStream used by the tcpclient.
 
Back
Top