CommunicationObject.OnBeginOpen(TimeSpan, AsyncCallback, Object) 方法

定義

在通訊物件上插入處理 (當它因為叫用非同步開啟作業而轉換到開啟狀態之後)。Inserts processing on a communication object after it transitions to the opening state due to the invocation of an asynchronous open operation.

protected:
 abstract IAsyncResult ^ OnBeginOpen(TimeSpan timeout, AsyncCallback ^ callback, System::Object ^ state);
protected abstract IAsyncResult OnBeginOpen (TimeSpan timeout, AsyncCallback callback, object state);
abstract member OnBeginOpen : TimeSpan * AsyncCallback * obj -> IAsyncResult
Protected MustOverride Function OnBeginOpen (timeout As TimeSpan, callback As AsyncCallback, state As Object) As IAsyncResult

參數

timeout
TimeSpan

TimeSpan,指定必須在逾時前多久完成開啟作業。The TimeSpan that specifies how long the on open operation has to complete before timing out.

callback
AsyncCallback

AsyncCallback 委派,這個委派會接收非同步開啟作業完成的通知。The AsyncCallback delegate that receives notification of the completion of the asynchronous on open operation.

state
Object

應用程式所指定的物件,其中包含與非同步開啟作業相關的狀態資訊。An object, specified by the application, that contains state information associated with the asynchronous on open operation.

傳回

參考非同步開啟作業的 IAsyncResultThe IAsyncResult that references the asynchronous on open operation.

例外狀況

通訊物件並非處於 OpenedOpening 狀態,無法修改。The communication object is not in a Opened or Opening state and cannot be modified.

通訊物件處於 ClosingClosed 狀態,無法修改。The communication object is in a Closing or Closed state and cannot be modified.

通訊物件處於 Faulted 狀態,無法修改。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.

備註

若要在通訊物件因為叫用同步 Open 作業而轉換至開啟狀態後插入處理,請使用 Open 方法。To insert processing after a communication object transitions to a opening state due to the invocation of a synchronous Open operation, use the Open method.

適用於