Редагувати

Поділитися через


IPGlobalStatistics.DefaultTtl Property

Definition

Gets the default time-to-live (TTL) value for Internet Protocol (IP) packets.

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

Property Value

An Int64 value that specifies the TTL.

Attributes

Examples

The following code example displays the value of this property.

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

Remarks

The TTL value is reported as the number of routing nodes that can forward a packet before it is discarded. Each node decrements the current TTL value in a packet before forwarding it. If the TTL value reaches zero, the packet is deemed undeliverable and is discarded. Note that when a packet travels from one node to another, this is also known as a "hop".

Applies to