แก้ไข

แชร์ผ่าน


UdpSingleSourceMulticastClient.BeginSendToSource Method

Definition

Caution

This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.

Begins the operation of sending a unicast packet to the source previously specified.

public:
 IAsyncResult ^ BeginSendToSource(cli::array <System::Byte> ^ buffer, int offset, int count, int remotePort, AsyncCallback ^ callback, System::Object ^ state);
[System.Obsolete("This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.", true)]
public IAsyncResult BeginSendToSource (byte[] buffer, int offset, int count, int remotePort, AsyncCallback callback, object state);
[<System.Obsolete("This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.", true)>]
member this.BeginSendToSource : byte[] * int * int * int * AsyncCallback * obj -> IAsyncResult
Public Function BeginSendToSource (buffer As Byte(), offset As Integer, count As Integer, remotePort As Integer, callback As AsyncCallback, state As Object) As IAsyncResult

Parameters

buffer
Byte[]

The buffer that contains the data to send.

offset
Int32

The offset, in bytes, from the beginning of the buffer to read the data to be sent.

count
Int32

The number of bytes to send from the buffer.

remotePort
Int32

The remote port to which the packet is to be sent. The remote address is specified by the UdpSingleSourceMulticastClient(IPAddress, IPAddress, Int32) constructor.

callback
AsyncCallback

The callback method to invoke when the operation completes.

state
Object

Optional state information to pass to the callback method for this operation.

Returns

An IAsyncResult that references this operation.

Attributes

Exceptions

buffer is a null reference (Nothing in Visual Basic).

offset is less than 0

-or-

offset is greater than the length of the buffer.

-or-

count is less than 0

-or-

offset plus the count is greater than the length of the buffer.

-or-

remotePort is less than 0 or greater than 65,535.

The multicast group has not yet been joined.

An error occurred when attempting to access the socket.

Remarks

The BeginSendToSource method begins an operation of sending a UDP packet to the source previously specified.

Some protocols use this information to pass along flow control, quality of service statistics, or recovery messages.

The method specified in the callback parameter is invoked when a packet has been sent.

The client must have completed a join to the multicast group.

If the destination port specified in the remotePort parameter is less than 1,024, a SocketException is thrown with AccessDenied.

It is possible to have a socket failure if a send operation fails synchronously, although this is uncommon with UDP. If a socket failure occurs, a SocketException is thrown. The error received is specified as a member of the SocketError enumeration.

Applies to