This topic has not yet been rated - Rate this topic

UdpSingleSourceMulticastClient.BeginReceiveFromSource Method

April 12, 2014

Begins the operation of receiving a packet from the joined multicast group and invokes the specified callback when a packet has arrived on the group from a specified sender.

Namespace:  System.Net.Sockets
Assembly:  System.Net (in System.Net.dll)
public IAsyncResult BeginReceiveFromSource(
	byte[] buffer,
	int offset,
	int count,
	AsyncCallback callback,
	Object state
)

Parameters

buffer
Type: System.Byte []
The buffer to store the received data.
offset
Type: System.Int32
The offset, in bytes, from the beginning of the buffer where the data should be stored.
count
Type: System.Int32
The maximum number of bytes to receive and store in 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.

Return Value

Type: System.IAsyncResult
An IAsyncResult that references this operation.
ExceptionCondition
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 UdpSingleSourceMulticastClient has been disposed.

SocketException

An error occurred when attempting to access the socket for receiving. See the Remarks section for more information.

The BeginReceiveFromSource method begins an operation of receiving a UDP packet from the joined multicast group from a single sender. The local port, multicast group, and sender source address are specified in the UdpSingleSourceMulticastClient constructor. The multicast client must also have completed a join to the multicast group.

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

It is possible to have a socket failure if a receive 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.

Windows Phone OS

Supported in: 8.1, 8.0, 7.1

Windows Phone

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.