Edit

Share via


IPv6MulticastOption Constructors

Definition

Initializes a new instance of the IPv6MulticastOption class.

Overloads

IPv6MulticastOption(IPAddress)

Initializes a new version of the IPv6MulticastOption class for the specified IP multicast group.

IPv6MulticastOption(IPAddress, Int64)

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

IPv6MulticastOption(IPAddress)

Source:
MulticastOption.cs
Source:
MulticastOption.cs
Source:
MulticastOption.cs
Source:
MulticastOption.cs

Initializes a new version of the IPv6MulticastOption class for the specified IP multicast group.

C#
public IPv6MulticastOption(System.Net.IPAddress group);

Parameters

group
IPAddress

The IPAddress of the multicast group.

Exceptions

group is null.

Examples

The following example creates an IPv6MulticastOption object.

C#
// Exercise the use of the IPv6MulticastOption.
Console.WriteLine("Instantiate IPv6MulticastOption(IPAddress)");

// Instantiate IPv6MulticastOption using one of the
// overloaded constructors.
IPv6MulticastOption ipv6MulticastOption = new IPv6MulticastOption(m_GrpAddr);

// Store the IPAdress multicast options.
IPAddress group =  ipv6MulticastOption.Group;
long interfaceIndex = ipv6MulticastOption.InterfaceIndex;

// Display IPv6MulticastOption properties.
Console.WriteLine("IPv6MulticastOption.Group: [" + group  + "]");
Console.WriteLine("IPv6MulticastOption.InterfaceIndex: [" + interfaceIndex + "]");

Applies to

.NET 10 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 1.3, 1.4, 1.6, 2.0, 2.1

IPv6MulticastOption(IPAddress, Int64)

Source:
MulticastOption.cs
Source:
MulticastOption.cs
Source:
MulticastOption.cs
Source:
MulticastOption.cs

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

C#
public IPv6MulticastOption(System.Net.IPAddress group, long ifindex);

Parameters

group
IPAddress

The group IPAddress.

ifindex
Int64

The local interface address.

Exceptions

ifindex is less than 0.

-or-

ifindex is greater than 0x00000000FFFFFFFF.

group is null.

Examples

The following example creates an IPv6MulticastOption object.

C#

// Instantiate IPv6MulticastOption using another
// overloaded constructor.
IPv6MulticastOption ipv6MulticastOption2 = new IPv6MulticastOption(group, interfaceIndex);

// Store the IPAdress multicast options.
group =  ipv6MulticastOption2.Group;
interfaceIndex = ipv6MulticastOption2.InterfaceIndex;

// Display the IPv6MulticastOption2 properties.
Console.WriteLine("IPv6MulticastOption.Group: [" + group  + "]");
Console.WriteLine("IPv6MulticastOption.InterfaceIndex: [" + interfaceIndex + "]");

// Join the specified multicast group using one of the
// JoinMulticastGroup overloaded methods.
clientOriginator.JoinMulticastGroup((int)interfaceIndex, group);

Remarks

The ifindex parameter specifies the interface on which data is received or sent.

Applies to

.NET 10 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 1.3, 1.4, 1.6, 2.0, 2.1