Share via


PingOptions 생성자

정의

PingOptions 클래스의 새 인스턴스를 초기화합니다.

오버로드

PingOptions()

PingOptions 클래스의 새 인스턴스를 초기화합니다.

PingOptions(Int32, Boolean)

PingOptions 클래스의 새 인스턴스를 초기화하고 Time to Live 및 조각화 값을 설정합니다.

PingOptions()

Source:
PingOptions.cs
Source:
PingOptions.cs
Source:
PingOptions.cs

PingOptions 클래스의 새 인스턴스를 초기화합니다.

public:
 PingOptions();
public PingOptions ();
Public Sub New ()

예제

다음 코드 예제에서는 이 생성자를 호출하는 방법을 보여 줍니다.

Ping ^ pingSender = gcnew Ping;
PingOptions ^ options = gcnew PingOptions;

// Use the default Ttl value which is 128,
// but change the fragmentation behavior.
options->DontFragment = true;
Ping pingSender = new Ping ();
PingOptions options = new PingOptions ();

// Use the default Ttl value which is 128,
// but change the fragmentation behavior.
options.DontFragment = true;
let pingSender = new Ping()

// Use the default Ttl value which is 128,
// but change the fragmentation behavior.
let options = PingOptions()
options.DontFragment <- true

설명

다음 표에서 인스턴스에 대 한 초기 속성 값을 보여 줍니다. PingOptions합니다.

속성 초기 값
Ttl 128
DontFragment false

또는 SendAsync를 호출 Send 하기 전에 속성을 새 값으로 설정할 수 있습니다.

적용 대상

PingOptions(Int32, Boolean)

Source:
PingOptions.cs
Source:
PingOptions.cs
Source:
PingOptions.cs

PingOptions 클래스의 새 인스턴스를 초기화하고 Time to Live 및 조각화 값을 설정합니다.

public:
 PingOptions(int ttl, bool dontFragment);
public PingOptions (int ttl, bool dontFragment);
new System.Net.NetworkInformation.PingOptions : int * bool -> System.Net.NetworkInformation.PingOptions
Public Sub New (ttl As Integer, dontFragment As Boolean)

매개 변수

ttl
Int32

Int32 데이터 패킷이 전달될 수 있는 횟수를 지정하는 0보다 큰 Ping 값입니다.

dontFragment
Boolean

원격 호스트로 보낼 데이터를 조각화하지 않으려면 true이고, 조각화하려면 false입니다.

예외

ttl가 0보다 작거나 같습니다.

예제

다음 코드 예제에서는이 생성자를 호출 하 고 새 instance 속성 값을 표시 합니다.

// 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 데이터를 전달할 수 있는 라우터 및 게이트웨이 수를 제한합니다. 이는 로컬 컴퓨터와 원격 컴퓨터 간의 경로 길이를 테스트하는 데 유용합니다. dontFragment 매개 변수를 사용하면 패킷을 전송하는 데 사용되는 라우터 및 게이트웨이의 최대 전송 단위(MTU)를 테스트할 수 있습니다.

적용 대상