CommunicationObject.BeginOpen Method

Definition

Begins an asynchronous operation to open a communication object.

Overloads

BeginOpen(AsyncCallback, Object)

Begins an asynchronous operation to open a communication object.

BeginOpen(TimeSpan, AsyncCallback, Object)

Begins an asynchronous operation to open a communication object within a specified interval of time.

BeginOpen(AsyncCallback, Object)

Begins an asynchronous operation to open a communication object.

public:
 virtual IAsyncResult ^ BeginOpen(AsyncCallback ^ callback, System::Object ^ state);
public IAsyncResult BeginOpen (AsyncCallback callback, object state);
abstract member BeginOpen : AsyncCallback * obj -> IAsyncResult
override this.BeginOpen : AsyncCallback * obj -> IAsyncResult
Public Function BeginOpen (callback As AsyncCallback, state As Object) As IAsyncResult

Parameters

callback
AsyncCallback

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

state
Object

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

Returns

The IAsyncResult that references the asynchronous open operation.

Implements

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 OnBeginOpen(TimeSpan, AsyncCallback, Object) method calls OnOpening and OnBeginOpen(TimeSpan, AsyncCallback, Object) if the communication object is initially in the Created state.

To insert processing after a communication object transitions to a closing state due to the invocation of a synchronous Open operation, use the Open method.

Applies to

BeginOpen(TimeSpan, AsyncCallback, Object)

Begins an asynchronous operation to open a communication object within a specified interval of time.

public:
 virtual IAsyncResult ^ BeginOpen(TimeSpan timeout, AsyncCallback ^ callback, System::Object ^ state);
public IAsyncResult BeginOpen (TimeSpan timeout, AsyncCallback callback, object state);
abstract member BeginOpen : TimeSpan * AsyncCallback * obj -> IAsyncResult
override this.BeginOpen : TimeSpan * AsyncCallback * obj -> IAsyncResult
Public Function BeginOpen (timeout As TimeSpan, callback As AsyncCallback, state As Object) As IAsyncResult

Parameters

timeout
TimeSpan

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

callback
AsyncCallback

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

state
Object

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

Returns

The IAsyncResult that references the asynchronous open operation.

Implements

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 BeginOpen(TimeSpan, AsyncCallback, Object) method calls OnOpening and OnBeginOpen(TimeSpan, AsyncCallback, Object) if the communication object is initially in the Created state.

To insert processing after a communication object transitions to a closing state due to the invocation of a synchronous Open operation, use the Open method.

Applies to