PingOptions 생성자

정의

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

오버로드

Name Description
PingOptions()

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

PingOptions(Int32, Boolean)

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

PingOptions()

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

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

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

예제

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

Ping pingSender = new Ping ();
PingOptions options = new PingOptions ();

// Use the default Ttl value which is 128,
// but change the fragmentation behavior.
options.DontFragment = true;

설명

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

재산 초기 값
Ttl 128
DontFragment false

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

적용 대상

PingOptions(Int32, Boolean)

Source:
PingOptions.cs
Source:
PingOptions.cs
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 데이터 패킷을 전달할 수 있는 횟수를 지정하는 Ping 0보다 큰 값입니다.

dontFragment
Boolean

true원격 호스트로 전송된 데이터가 조각화되지 않도록 합니다. 그렇지 않으면 . false

예외

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

예제

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

// 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(최대 전송 단위)를 테스트할 수 있습니다.

적용 대상