Compartir a través de


UdpAnySourceMulticastClient.BeginJoinGroup Method

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

Binds the socket and begins a join operation to the multicast group to allow datagrams to be received from any group participant.

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

Syntax

'Declaration
<SecuritySafeCriticalAttribute> _
Public Function BeginJoinGroup ( _
    callback As AsyncCallback, _
    state As Object _
) As IAsyncResult
[SecuritySafeCriticalAttribute]
public IAsyncResult BeginJoinGroup(
    AsyncCallback callback,
    Object state
)

Parameters

  • 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.

Exceptions

Exception Condition
InvalidOperationException

The multicast group has already been joined or a join operation is currently in progress.

ObjectDisposedException

The UdpAnySourceMulticastClient has been disposed.

SocketException

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

Remarks

The BeginJoinGroup method binds a UDP multicast socket to a local port and joins a multicast group to allow datagrams to be received from any multicast group participant. The local port and multicast group address are specified in the UdpAnySourceMulticastClient constructor.

The method specified in the callback parameter is invoked when the operation to join the multicast group has completed.

If required by the runtime, the BeginJoinGroup method also performs a policy check to verify that the client is allowed to access the multicast group. If the client is not allowed access, a SocketException is thrown with SocketError.AccessDenied.

Version Notes

Silverlight for Windows Phone Silverlight for Windows Phone

In Silverlight for Windows Phone applications, this method will successfully complete when the device running the application is connected to a wireless network, or if you are debugging with the emulator running on a computer connected to the Internet. If you call BeginJoinGroup when the device is connected to a cellular network only, a SocketException will occur.

Version Information

Silverlight

Supported in: 5, 4

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1

Platforms

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