語言

IPGlobalStatistics.DefaultTtl 屬性

定義

取得網際網路協定(IP)封包的預設存活時間(TTL)值。

public:
 abstract property int DefaultTtl { int get(); };
[System.Runtime.Versioning.UnsupportedOSPlatform("android")]
public abstract int DefaultTtl { get; }
public abstract int DefaultTtl { get; }
[<System.Runtime.Versioning.UnsupportedOSPlatform("android")>]
member this.DefaultTtl : int
member this.DefaultTtl : int
Public MustOverride ReadOnly Property DefaultTtl As Integer

屬性值

一個 Int64 指定 TTL 的值。

屬性

範例

以下程式碼範例顯示此屬性的值。

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 值歸零,封包視為無法投遞並丟棄。 請注意,當封包從一個節點傳送到另一個節點時,這也被稱為「跳躍」。

適用於