IPAddress.IPv6None Pole
Definicja
Ważny
Niektóre informacje dotyczą produktów przedpremierowych, które mogą zostać znacznie zmodyfikowane przed premierą. Microsoft nie udziela żadnych gwarancji, ani wyraźnych, ani domniemanych, dotyczących informacji podanych tutaj.
Zawiera adres IP wskazujący, że nie należy używać interfejsu sieciowego. Ta właściwość jest tylko do odczytu.
public: static initonly System::Net::IPAddress ^ IPv6None;
public static readonly System.Net.IPAddress IPv6None;
staticval mutable IPv6None : System.Net.IPAddress
Public Shared ReadOnly IPv6None As IPAddress
Wartość pola
Przykłady
Poniższy przykład kodu przedstawia wartość adresu None bieżącego hosta w standardowym formacie skompresowanym.
// This method displays the value of the current host's None address in
// standard compressed format. The None address is used by the host to disable
// listening to client activities on all the interfaces.
private static void displayIPv6NoneAddress()
{
try
{
// Get the None address.
IPAddress none = IPAddress.IPv6None;
// Transform the None address to a string using the overloaded
// ToString() method. Note that the resulting string is in the compact
// form: "::".
string ipv6None = none.ToString();
Console.WriteLine("The IPv6 None address is: " + ipv6None);
}
catch (Exception e)
{
Console.WriteLine("[displayIPv6NoneAddress] Exception: " + e.ToString());
}
}
' This function prints the value of the current host's None address in
' standard compressed format. The None address is used by the host to disable
' listening to client activities on all the interfaces.
Private Shared Sub printIPv6NoneAddress()
Try
' Get the None address.
Dim none As IPAddress = IPAddress.IPv6None
' Transform the None address to a string using the overloaded
' ToString() method. Note that the resulting string is in the compact
' form: "::".
Dim ipv6None As String = none.ToString()
Console.WriteLine(("The IPv6 None address is: " + ipv6None))
Catch e As Exception
Console.WriteLine(("[printIPv6NoneAddress] Exception: " + e.ToString()))
End Try
End Sub
Uwagi
Metoda Socket.Bind używa pola, IPv6None aby wskazać, że działanie Socket klienta nie może nasłuchiwać. Pole IPv6None jest równoważne notacji dwukropkowej 0:0:0:0:0:0:0 w notacji dwukropkowej szesnastkowej lub do ::0 w zapisie kompaktowym.