PingOptions.Ttl 속성

정의

Ping 데이터가 삭제되기 전에 이 데이터를 전달할 수 있는 라우팅 노드의 수를 가져오거나 설정합니다.

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

속성 값

Int32 데이터 패킷이 전달될 수 있는 횟수를 지정하는 Ping 값입니다. 기본값은 128입니다.

예외

set 작업에 지정된 값이 0 이하입니다.

예제

다음 코드 예제를 사용 하 여이 속성의 값을 설정 하는 방법을 보여 줍니다는 PingOptions 생성자를 사용 하 여 다음 값을 표시 합니다.

// Set options for transmission:
// The data can go through 64 gateways or routers
// before it is destroyed, and the data packet
// cannot be fragmented.
PingOptions ^ options = gcnew PingOptions( 64,true );
Console::WriteLine( "Time to live: {0}", options->Ttl );
Console::WriteLine( "Don't fragment: {0}", options->DontFragment );
// Set options for transmission:
// The data can go through 64 gateways or routers
// before it is destroyed, and the data packet
// cannot be fragmented.
PingOptions options = new PingOptions (64, true);

Console.WriteLine ("Time to live: {0}", options.Ttl);
Console.WriteLine ("Don't fragment: {0}", options.DontFragment);

설명

게이트웨이 및 라우터는 네트워크를 통해 패킷을 전송할 때 패킷 헤더에 있는 현재 TTL(Time-to-Live) 값을 감소합니다. TTL 값이 0에 도달하면 패킷은 배달할 수 없는 것으로 간주되고 삭제됩니다. 이 옵션은 데이터를 전송하는 데 사용되는 라우터 및 게이트웨이 수를 테스트하려는 경우에 유용합니다.

적용 대상