CommunicationObject.OnBeginClose(TimeSpan, AsyncCallback, Object) Method

Definition

Inserts processing after a communication object transitions to the closing state due to the invocation of an asynchronous close operation.

C#
protected abstract IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state);

Parameters

timeout
TimeSpan

The TimeSpan that specifies how long the on close operation has to complete before timing out.

callback
AsyncCallback

The AsyncCallback delegate that receives notification of the completion of the asynchronous on close operation.

state
Object

An object, specified by the application, that contains state information associated with the asynchronous on close operation.

Returns

The IAsyncResult that references the asynchronous on close operation.

Exceptions

The communication object is not in a Opened or Opening state and cannot be modified.

The communication object is in a Closing or Closed state and cannot be modified.

The communication object is in a Faulted state and cannot be modified.

The default interval of time that was allotted for the operation was exceeded before the operation was completed.

Remarks

The BeginClose method calls OnBeginClose if the communication object is initially in the Opened state.

To insert processing after a communication object transitions to a closing state due to the invocation of a synchronous Close operation, use the OnClose(TimeSpan) method.

Applies to

Product Versions
.NET Core 1.0, Core 1.1, 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
UWP 10.0