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}",

.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
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
© 2015 Microsoft