CommunicationObject.OnBeginClose(TimeSpan, AsyncCallback, Object) 方法
定义
在调用了异步关闭操作,从而引起通信对象转换为正在关闭状态的情况下,该方法将插入处理。Inserts processing after a communication object transitions to the closing state due to the invocation of an asynchronous close operation.
protected:
abstract IAsyncResult ^ OnBeginClose(TimeSpan timeout, AsyncCallback ^ callback, System::Object ^ state);
protected abstract IAsyncResult OnBeginClose (TimeSpan timeout, AsyncCallback callback, object state);
abstract member OnBeginClose : TimeSpan * AsyncCallback * obj -> IAsyncResult
Protected MustOverride Function OnBeginClose (timeout As TimeSpan, callback As AsyncCallback, state As Object) As IAsyncResult
参数
- timeout
- TimeSpan
TimeSpan,指定在超时前必须完成关闭操作的时间。The TimeSpan that specifies how long the on close operation has to complete before timing out.
- callback
- AsyncCallback
接收关闭操作异步完成通知的 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.
返回
引用异步关闭操作的 IAsyncResult。The IAsyncResult that references the asynchronous on close operation.
例外
通信对象未处于 Opened 或 Opening 状态,因此无法修改。The communication object is not in a Opened or Opening state and cannot be modified.
通信对象处于 Closing 或 Closed 状态,因此无法修改。The communication object is in a Closing or Closed state and cannot be modified.
在操作完成之前超出了分配给该操作的默认时间间隔。The default interval of time that was allotted for the operation was exceeded before the operation was completed.
注解
如果通信对象最初处于 BeginClose 状态,则 OnBeginClose 方法将调用 Opened。The BeginClose method calls OnBeginClose if the communication object is initially in the Opened state.
在调用了同步 Close 操作,从而引起通信对象转换为正在关闭状态的情况下,若要插入处理,请使用 OnClose(TimeSpan) 方法。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.