Close Method
Collapse the table of content
Expand the table of content

Socket.Close Method

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Closes the Socket connection and releases all associated resources.

Namespace:  System.Net.Sockets
Assembly:  System.Net (in System.Net.dll)

public void Close()

The Close method closes the remote host connection and releases all managed and unmanaged resources associated with the Socket. Upon closing, the Connected property is set to false.

For connection-oriented protocols, it is recommended that you call Shutdown before calling the Close method. This ensures that all data is sent and received on the connected socket before it is closed.

Windows Phone OS

Supported in: 8.1, 8.0, 7.1

Windows Phone

Show:
© 2017 Microsoft