IPGlobalStatistics.DefaultTtl 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得網際網路通訊協定 (IP) 封包的預設存留時間 (TTL) 值。
public:
abstract property int DefaultTtl { int get(); };
public abstract int DefaultTtl { get; }
[System.Runtime.Versioning.UnsupportedOSPlatform("android")]
public abstract int DefaultTtl { get; }
member this.DefaultTtl : int
[<System.Runtime.Versioning.UnsupportedOSPlatform("android")>]
member this.DefaultTtl : int
Public MustOverride ReadOnly Property DefaultTtl As Integer
屬性值
Int64 值,指定 TTL。
- 屬性
範例
下列程式代碼範例會顯示此屬性的值。
void ShowIPStatistics()
{
IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties();
IPGlobalStatistics ^ ipstat = properties->GetIPv4GlobalStatistics();
Console::WriteLine( " Forwarding enabled ...................... : {0}",
ipstat->ForwardingEnabled );
Console::WriteLine( " Interfaces .............................. : {0}",
ipstat->NumberOfInterfaces );
Console::WriteLine( " IP addresses ............................ : {0}",
ipstat->NumberOfIPAddresses );
Console::WriteLine( " Routes .................................. : {0}",
ipstat->NumberOfRoutes );
Console::WriteLine( " Default TTL ............................. : {0}",
ipstat->DefaultTtl );
}
public static void ShowIPStatistics()
{
IPGlobalProperties properties = IPGlobalProperties.GetIPGlobalProperties();
IPGlobalStatistics ipstat = properties.GetIPv4GlobalStatistics();
Console.WriteLine(" Forwarding enabled ...................... : {0}",
ipstat.ForwardingEnabled);
Console.WriteLine(" Interfaces .............................. : {0}",
ipstat.NumberOfInterfaces);
Console.WriteLine(" IP addresses ............................ : {0}",
ipstat.NumberOfIPAddresses);
Console.WriteLine(" Routes .................................. : {0}",
ipstat.NumberOfRoutes);
Console.WriteLine(" Default TTL ............................. : {0}",
ipstat.DefaultTtl);
}
Public Shared Sub ShowIPStatistics()
Dim properties As IPGlobalProperties = IPGlobalProperties.GetIPGlobalProperties()
Dim ipstat As IPGlobalStatistics = properties.GetIPv4GlobalStatistics()
Console.WriteLine(" Forwarding enabled ...................... : {0}", ipstat.ForwardingEnabled)
Console.WriteLine(" Interfaces .............................. : {0}", ipstat.NumberOfInterfaces)
Console.WriteLine(" IP addresses ............................ : {0}", ipstat.NumberOfIPAddresses)
Console.WriteLine(" Routes .................................. : {0}", ipstat.NumberOfRoutes)
Console.WriteLine(" Default TTL ............................. : {0}", ipstat.DefaultTtl)
End Sub
備註
TTL 值會報告為可在捨棄封包之前轉送封包的路由節點數目。 每個節點在轉送之前,都會遞減封包中的目前TTL值。 如果 TTL 值達到零,封包會被視為無法傳遞,而且會被捨棄。 請注意,當封包從一個節點移到另一個節點時,也稱為「躍點」。