System.Net.Sockets.Socket.Blocking Property

Gets or sets a value that indicates whether the System.Net.Sockets.Socket is in blocking mode.

Syntax

public bool Blocking { get; set; }

Value

true indicates that the current instance is in blocking mode; false indicates that the current instance is in non-blocking mode.

Exceptions

TypeReason
ObjectDisposedExceptionThe current instance has been disposed.

Remarks

The Socket.Blocking property indicates whether a System.Net.Sockets.Socket is in blocking mode.

If you are in blocking mode, and you make a method call which does not complete immediately, your application will block execution until the requested operation completes. If you want execution to continue even though the requested operation is not complete, change the Socket.Blocking property to false. The Socket.Blocking property has no effect on asynchronous methods. If you are sending and receiving data asynchronously and want to block execution, use the System.Threading.ManualResetEvent class.

Note:

If you receive a System.Net.Sockets.SocketException, use the SocketException.ErrorCode property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error.

Note:

This member outputs trace information when you enable network tracing in your application. For more information, see [<topic://conUsingNetworkTracing>].

Requirements

Namespace: System.Net.Sockets
Assembly: System (in System.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0