UdpClient.Ttl 屬性

定義

取得或設定值,指定由 UdpClient 傳送之網際網路通訊協定 (IP) 封包的存留時間 (TTL) 值。

public:
 property short Ttl { short get(); void set(short value); };
public short Ttl { get; set; }
member this.Ttl : int16 with get, set
Public Property Ttl As Short

屬性值

TTL 值。

範例

下列程式代碼範例顯示 屬性的使用 Ttl

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

備註

TTL 值表示在路由器捨棄封包之前可以周遊的路由器數目上限,而因特網控制訊息通訊協定 (ICMP) 「超過 TTL」錯誤訊息傳回給傳送者。

適用於