Socket.Blocking Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets or sets a value that indicates whether the Socket is in blocking mode.
public:
property bool Blocking { bool get(); void set(bool value); };
public bool Blocking { get; set; }
member this.Blocking : bool with get, set
Public Property Blocking As Boolean
Property Value
true
if the Socket will block; otherwise, false
. The default is true
.
Exceptions
An error occurred when attempting to access the socket.
The Socket has been closed.
Remarks
The Blocking property indicates whether a 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 Blocking property to false
. The Blocking property has no effect on asynchronous methods. If you are sending and receiving data asynchronously and want to block execution, use the ManualResetEvent class.
Note
If you receive a 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 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 Network Tracing in .NET Framework.