Επεξεργασία

Κοινή χρήση μέσω


IOutputChannel.BeginSend Method

Definition

Begins an asynchronous operation to send a message.

Overloads

BeginSend(Message, AsyncCallback, Object)

Begins an asynchronous operation to transmit a message to the destination of the output channel.

BeginSend(Message, TimeSpan, AsyncCallback, Object)

Begins an asynchronous operation to transmit a message to the destination of the output channel within a specified interval of time.

BeginSend(Message, AsyncCallback, Object)

Source:
IOutputChannel.cs
Source:
IOutputChannel.cs

Begins an asynchronous operation to transmit a message to the destination of the output channel.

public:
 IAsyncResult ^ BeginSend(System::ServiceModel::Channels::Message ^ message, AsyncCallback ^ callback, System::Object ^ state);
public IAsyncResult BeginSend (System.ServiceModel.Channels.Message message, AsyncCallback callback, object state);
abstract member BeginSend : System.ServiceModel.Channels.Message * AsyncCallback * obj -> IAsyncResult
Public Function BeginSend (message As Message, callback As AsyncCallback, state As Object) As IAsyncResult

Parameters

message
Message

The Message being sent on the output channel.

callback
AsyncCallback

The AsyncCallback delegate.

state
Object

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

Returns

The IAsyncResult that references the asynchronous message transmission.

Examples

The following code illustrates how to implement this method:

public IAsyncResult BeginReceiveRequest(TimeSpan timeout, AsyncCallback callback, object state)
{
    ReceiveRequestAsyncResult result = new ReceiveRequestAsyncResult(this, timeout, callback, state);
    result.Begin();
    return result;
}

Remarks

The destination for messages sent out on an output channel is specified at channel creation time.

The BeginSend method does not guarantee the delivery of message to the remote endpoint. If delivery guarantees are required, use the IOutputSessionChannel.

If the message sent is larger that the maximum message size allowed by the binding being used, a QuotaExceededException is thrown. The maximum message size is set by the MaxReceivedMessageSize property. The default value is 65536 bytes.

Applies to

BeginSend(Message, TimeSpan, AsyncCallback, Object)

Source:
IOutputChannel.cs
Source:
IOutputChannel.cs

Begins an asynchronous operation to transmit a message to the destination of the output channel within a specified interval of time.

public:
 IAsyncResult ^ BeginSend(System::ServiceModel::Channels::Message ^ message, TimeSpan timeout, AsyncCallback ^ callback, System::Object ^ state);
public IAsyncResult BeginSend (System.ServiceModel.Channels.Message message, TimeSpan timeout, AsyncCallback callback, object state);
abstract member BeginSend : System.ServiceModel.Channels.Message * TimeSpan * AsyncCallback * obj -> IAsyncResult
Public Function BeginSend (message As Message, timeout As TimeSpan, callback As AsyncCallback, state As Object) As IAsyncResult

Parameters

message
Message

The Message being sent on the output channel.

timeout
TimeSpan

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

callback
AsyncCallback

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

state
Object

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

Returns

The IAsyncResult that references the asynchronous send operation.

Examples

The following code illustrates how to implement this method:

public RequestContext EndReceiveRequest(IAsyncResult result)
{
    return ReceiveRequestAsyncResult.End(result);
}

Remarks

The destination for messages sent out on an output channel is specified at channel creation time.

The BeginSend method does not guarantee the delivery of message to the remote endpoint. If delivery guarantees are required, use IOutputSessionChannel.

If the message sent is larger that the maximum message size allowed by the binding being used, a QuotaExceededException is thrown. The maximum message size is set by the MaxReceivedMessageSize property. The default value is 65536 bytes.

Notes to Implementers

The operation should throw a TimeoutException if the specified timeout is exceeded.

Applies to