UdpClient.Ttl Property

 

Gets or sets a value that specifies the Time to Live (TTL) value of Internet Protocol (IP) packets sent by the UdpClient.

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

public short Ttl { get; set; }

Property Value

Type: System.Int16

The TTL value.

The TTL value indicates the maximum number of routers a packet can traverse before the router discards the packet and an Internet Control Message Protocol (ICMP) "TTL exceeded" error message is returned to the sender.

The following code example shows the use of the Ttl property.

public static void GetSetTtl(UdpClient u)
{
    // Set the Time To Live (TTL) for this client.
    u.Ttl = 42;
    Console.WriteLine("Ttl value is {0}",
        u.Ttl);
}

.NET Framework
Available since 2.0
Return to top
Show: