UdpAnySourceMulticastClient.BeginSendToGroup Method
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Begins the operation of sending a packet to a joined multicast group and invokes the specified callback when a packet has been sent to the group.
Assembly: System.Net (in System.Net.dll)
public IAsyncResult BeginSendToGroup( byte[] buffer, int offset, int count, AsyncCallback callback, Object state )
Parameters
- buffer
- Type:
System.Byte
[]
The buffer that contains the data to send.
- offset
- Type: System.Int32
The offset, in bytes, from the beginning of the buffer to read the data to be sent.
- count
- Type: System.Int32
The number of bytes to send from the buffer.
- callback
- Type: System.AsyncCallback
The callback method to invoke when the operation completes.
- state
- Type: System.Object
Optional state information to pass to the callback method for this operation.
| Exception | Condition |
|---|---|
| ArgumentNullException | buffer is null. |
| ArgumentOutOfRangeException | 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. |
| InvalidOperationException | The multicast group has not yet been joined. |
| ObjectDisposedException | The UdpAnySourceMulticastClient has been disposed. |
| SocketException | An error occurred when attempting to access the socket for sending. See the Remarks section for more information. |
The BeginSendToGroup method begins an operation of sending a UDP packet to the joined multicast group.
The client must have completed a join to the multicast group.
The method specified in the callback parameter is invoked when a packet has been sent.
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 System.Net.Sockets.SocketError enumeration.