MulticastOption Constructor (IPAddress, IPAddress)

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Initializes a new instance of the MulticastOption class with the specified IP multicast group address and local IP address associated with a network interface.

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

public MulticastOption(
	IPAddress group,
	IPAddress mcint
)

Parameters

group
Type: System.Net.IPAddress

The group IPAddress.

mcint
Type: System.Net.IPAddress

The local IPAddress.

Exception Condition
ArgumentNullException

group is null.

-or-

mcint is null.

For machines with multiple network cards, you must use this constructor to create MulticastOption instances.

The following example creates a MulticastOption object.


// Define a MulticastOption object specifying the multicast group 
// address and the local IPAddress.
// The multicast group address is the same as the address used by the server.
mcastOption = new MulticastOption(mcastAddress, localIPAddr);

mcastSocket.SetSocketOption(SocketOptionLevel.IP, 
                            SocketOptionName.AddMembership, 
                            mcastOption);

.NET Framework
Available since 1.1
Return to top
Show: