IPGlobalStatistics.DefaultTtl 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取 Internet 协议 (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
属性值
指定 TTL 的 Int64 值。
- 属性
示例
下面的代码示例显示此属性的值。
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 值达到零,则数据包被视为无法送达并被丢弃。 请注意,当数据包从一个节点传到另一个节点时,这也称为“跃点”。