IPv6MulticastOption 建構函式
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
初始化 IPv6MulticastOption 類別的新執行個體。
多載
IPv6MulticastOption(IPAddress) |
針對指定的 IP 多點傳送群組,初始化新版本的 IPv6MulticastOption 類別。 |
IPv6MulticastOption(IPAddress, Int64) |
使用指定的 IP 多點傳送群組和本機介面位址,初始化 IPv6MulticastOption 類別的新執行個體。 |
IPv6MulticastOption(IPAddress)
針對指定的 IP 多點傳送群組,初始化新版本的 IPv6MulticastOption 類別。
public:
IPv6MulticastOption(System::Net::IPAddress ^ group);
public IPv6MulticastOption (System.Net.IPAddress group);
new System.Net.Sockets.IPv6MulticastOption : System.Net.IPAddress -> System.Net.Sockets.IPv6MulticastOption
Public Sub New (group As IPAddress)
參數
例外狀況
group
為 null
。
範例
下列範例會 IPv6MulticastOption 建立物件。
// Exercise the use of the IPv6MulticastOption.
Console::WriteLine( "Instantiate IPv6MulticastOption(IPAddress)" );
// Instantiate IPv6MulticastOption using one of the
// overloaded constructors.
IPv6MulticastOption^ ipv6MulticastOption = gcnew IPv6MulticastOption( m_GrpAddr );
// Store the IPAdress multicast options.
IPAddress^ group = ipv6MulticastOption->Group;
__int64 interfaceIndex = ipv6MulticastOption->InterfaceIndex;
// Display IPv6MulticastOption properties.
Console::WriteLine( "IPv6MulticastOption::Group: [ {0}]", group );
Console::WriteLine( "IPv6MulticastOption::InterfaceIndex: [ {0}]", interfaceIndex );
// 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 + "]");
' Exercise the use of the IPv6MulticastOption.
Console.WriteLine("Instantiate IPv6MulticastOption(IPAddress)")
' Instantiate IPv6MulticastOption using one of the
' overloaded constructors.
Dim ipv6MulticastOption As New IPv6MulticastOption(m_GrpAddr)
' Store the IPAdress multicast options.
Dim group As IPAddress = ipv6MulticastOption.Group
Dim interfaceIndex As Long = ipv6MulticastOption.InterfaceIndex
' Display IPv6MulticastOption properties.
Console.WriteLine(("IPv6MulticastOption.Group: [" + group.ToString() + "]"))
Console.WriteLine(("IPv6MulticastOption.InterfaceIndex: [" + interfaceIndex.ToString() + "]"))
適用於
IPv6MulticastOption(IPAddress, Int64)
使用指定的 IP 多點傳送群組和本機介面位址,初始化 IPv6MulticastOption 類別的新執行個體。
public:
IPv6MulticastOption(System::Net::IPAddress ^ group, long ifindex);
public IPv6MulticastOption (System.Net.IPAddress group, long ifindex);
new System.Net.Sockets.IPv6MulticastOption : System.Net.IPAddress * int64 -> System.Net.Sockets.IPv6MulticastOption
Public Sub New (group As IPAddress, ifindex As Long)
參數
- ifindex
- Int64
本機介面位址。
例外狀況
group
為 null
。
範例
下列範例會 IPv6MulticastOption 建立物件。
// Instantiate IPv6MulticastOption using another
// overloaded constructor.
IPv6MulticastOption^ ipv6MulticastOption2 = gcnew IPv6MulticastOption( group,interfaceIndex );
// Store the IPAdress multicast options.
group = ipv6MulticastOption2->Group;
interfaceIndex = ipv6MulticastOption2->InterfaceIndex;
// Display the IPv6MulticastOption2 properties.
Console::WriteLine( "IPv6MulticastOption::Group: [ {0} ]", group );
Console::WriteLine( "IPv6MulticastOption::InterfaceIndex: [ {0} ]", interfaceIndex );
// Join the specified multicast group using one of the
// JoinMulticastGroup overloaded methods.
clientOriginator->JoinMulticastGroup( (int)interfaceIndex, group );
// 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);
' Instantiate IPv6MulticastOption using another
' overloaded constructor.
Dim ipv6MulticastOption2 As New IPv6MulticastOption(group, interfaceIndex)
' Store the IPAdress multicast options.
group = ipv6MulticastOption2.Group
interfaceIndex = ipv6MulticastOption2.InterfaceIndex
' Display the IPv6MulticastOption2 properties.
Console.WriteLine(("IPv6MulticastOption.Group: [" + group.ToString() + "]"))
Console.WriteLine(("IPv6MulticastOption.InterfaceIndex: [" + interfaceIndex.ToString() + "]"))
' Join the specified multicast group using one of the
' JoinMulticastGroup overloaded methods.
clientOriginator.JoinMulticastGroup(Fix(interfaceIndex), group)
備註
參數 ifindex
會指定接收或傳送數據的介面。