socket_object.Close Method

Closes the network connection associated with a Socket, TcpListener, TcpClient, or UdpClient Object.

socket_object.Close
-or-
tcplistener_object.Close
-or-
tcpclient_object.Close
-or-
udpclient_object.Close

Prerequisites

None

Parameters

None

Remarks

The Close method may be used to close the network connection and free up resources. If it is called with a TcpListener, TcpClient, or UdpClient Object, the underlying Socket is actually closed. If the Socket is not currently open, no error occurs.

Examples

Dim tl As New TcpListener(ep)
Dim sock As Socket
...
tl.Close
sock.Close

See Also

Networking Classes