Export (0) Print
Expand All

IPGlobalStatistics.DefaultTtl Property

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

Namespace:  System.Net.NetworkInformation
Assembly:  System (in System.dll)

public abstract int DefaultTtl { get; }

Property Value

Type: System.Int32
An Int64 value that specifies the TTL.

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".

The following code example displays the value of this property.

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);
}

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Show:
© 2015 Microsoft