SocketShutdown Enum

Specifies the direction in which a Socket is shut down.

Members

SocketShutdown.Receive

Indicates that this Socket will no longer receive data.

Example

// Assume 'socket' is an initialized Socket object
socket.Shutdown(SocketShutdown.Receive);

SocketShutdown.Send

Indicates that this Socket will no longer send data.

Example

// Assume 'socket' is an initialized Socket object
socket.Shutdown(SocketShutdown.Send);

SocketShutdown.Both

Indicates that this Socket will no longer send or receive data.

Example

// Assume 'socket' is an initialized Socket object
socket.Shutdown(SocketShutdown.Both);

Remarks

The SocketShutdown enumeration is used with the Socket.Shutdown method to control the direction of the shutdown operation. Calling Socket.Shutdown gracefully closes the connection by preventing further sends or receives, while still allowing buffered data to be sent or received.

If you need to completely terminate the connection immediately, you should use the Socket.Close method.

Requirements

Namespace: System.Net.Sockets

Assembly: System.Net.Sockets.dll