UdpAnySourceMulticastClient.BeginReceiveFromGroup Method

Microsoft Silverlight will reach end of support after October 2021. Learn more.

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 any sender.

Namespace:  System.Net.Sockets
Assembly:  System.Net (in System.Net.dll)


<SecuritySafeCriticalAttribute> _
Public Function BeginReceiveFromGroup ( _
    buffer As Byte(), _
    offset As Integer, _
    count As Integer, _
    callback As AsyncCallback, _
    state As Object _
) As IAsyncResult
public IAsyncResult BeginReceiveFromGroup(
    byte[] buffer,
    int offset,
    int count,
    AsyncCallback callback,
    Object state


  • buffer
    Type: array<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.
  • 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.


Exception Condition

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


offset is less than 0


offset is greater than the length of the buffer.


count is less than 0


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


The multicast group has not yet been joined.


The UdpAnySourceMulticastClient has been disposed.


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


The BeginReceiveFromGroup method begins an operation of receiving a UDP packet from the joined multicast group from any sender. The local port and multicast group address are specified in the UdpAnySourceMulticastClient 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.

Version Information


Supported in: 5, 4

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1


For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.