Ping.SendPingAsync Ping.SendPingAsync Ping.SendPingAsync Ping.SendPingAsync Method

Definition

Sends an Internet Control Message Protocol (ICMP) echo message to a computer, and receives a corresponding ICMP echo reply message from that computer as an asynchronous operation.

Overloads

SendPingAsync(String, Int32, Byte[], PingOptions) SendPingAsync(String, Int32, Byte[], PingOptions) SendPingAsync(String, Int32, Byte[], PingOptions) SendPingAsync(String, Int32, Byte[], PingOptions)

Sends an Internet Control Message Protocol (ICMP) echo message with the specified data buffer to the specified computer, and receive a corresponding ICMP echo reply message from that computer as an asynchronous operation. This overload allows you to specify a time-out value for the operation, a buffer to use for send and receive, and control fragmentation and Time-to-Live values for the ICMP echo message packet.

SendPingAsync(IPAddress) SendPingAsync(IPAddress) SendPingAsync(IPAddress) SendPingAsync(IPAddress)

Send an Internet Control Message Protocol (ICMP) echo message with the specified data buffer to the computer that has the specified IPAddress, and receives a corresponding ICMP echo reply message from that computer as an asynchronous operation.

SendPingAsync(String) SendPingAsync(String) SendPingAsync(String) SendPingAsync(String)

Sends an Internet Control Message Protocol (ICMP) echo message with the specified data buffer to the specified computer, and receive a corresponding ICMP echo reply message from that computer as an asynchronous operation.

SendPingAsync(IPAddress, Int32) SendPingAsync(IPAddress, Int32) SendPingAsync(IPAddress, Int32) SendPingAsync(IPAddress, Int32)

Send an Internet Control Message Protocol (ICMP) echo message with the specified data buffer to the computer that has the specified IPAddress, and receives a corresponding ICMP echo reply message from that computer as an asynchronous operation. This overload allows you to specify a time-out value for the operation.

SendPingAsync(String, Int32) SendPingAsync(String, Int32) SendPingAsync(String, Int32) SendPingAsync(String, Int32)

Sends an Internet Control Message Protocol (ICMP) echo message with the specified data buffer to the specified computer, and receive a corresponding ICMP echo reply message from that computer as an asynchronous operation. This overload allows you to specify a time-out value for the operation.

SendPingAsync(IPAddress, Int32, Byte[]) SendPingAsync(IPAddress, Int32, Byte[]) SendPingAsync(IPAddress, Int32, Byte[]) SendPingAsync(IPAddress, Int32, Byte[])

Send an Internet Control Message Protocol (ICMP) echo message with the specified data buffer to the computer that has the specified IPAddress, and receives a corresponding ICMP echo reply message from that computer as an asynchronous operation. This overload allows you to specify a time-out value for the operation and a buffer to use for send and receive.

SendPingAsync(String, Int32, Byte[]) SendPingAsync(String, Int32, Byte[]) SendPingAsync(String, Int32, Byte[]) SendPingAsync(String, Int32, Byte[])

Sends an Internet Control Message Protocol (ICMP) echo message with the specified data buffer to the specified computer, and receive a corresponding ICMP echo reply message from that computer as an asynchronous operation. This overload allows you to specify a time-out value for the operation and a buffer to use for send and receive.

SendPingAsync(IPAddress, Int32, Byte[], PingOptions) SendPingAsync(IPAddress, Int32, Byte[], PingOptions) SendPingAsync(IPAddress, Int32, Byte[], PingOptions) SendPingAsync(IPAddress, Int32, Byte[], PingOptions)

Send an Internet Control Message Protocol (ICMP) echo message with the specified data buffer to the computer that has the specified IPAddress, and receives a corresponding ICMP echo reply message from that computer as an asynchronous operation. This overload allows you to specify a time-out value for the operation, a buffer to use for send and receive, and control fragmentation and Time-to-Live values for the ICMP echo message packet.

SendPingAsync(String, Int32, Byte[], PingOptions) SendPingAsync(String, Int32, Byte[], PingOptions) SendPingAsync(String, Int32, Byte[], PingOptions) SendPingAsync(String, Int32, Byte[], PingOptions)

Sends an Internet Control Message Protocol (ICMP) echo message with the specified data buffer to the specified computer, and receive a corresponding ICMP echo reply message from that computer as an asynchronous operation. This overload allows you to specify a time-out value for the operation, a buffer to use for send and receive, and control fragmentation and Time-to-Live values for the ICMP echo message packet.

public:
 System::Threading::Tasks::Task<System::Net::NetworkInformation::PingReply ^> ^ SendPingAsync(System::String ^ hostNameOrAddress, int timeout, cli::array <System::Byte> ^ buffer, System::Net::NetworkInformation::PingOptions ^ options);
public System.Threading.Tasks.Task<System.Net.NetworkInformation.PingReply> SendPingAsync (string hostNameOrAddress, int timeout, byte[] buffer, System.Net.NetworkInformation.PingOptions options);
member this.SendPingAsync : string * int * byte[] * System.Net.NetworkInformation.PingOptions -> System.Threading.Tasks.Task<System.Net.NetworkInformation.PingReply>
Public Function SendPingAsync (hostNameOrAddress As String, timeout As Integer, buffer As Byte(), options As PingOptions) As Task(Of PingReply)
Parameters
hostNameOrAddress
String String String String

The computer that is the destination for the ICMP echo message. The value specified for this parameter can be a host name or a string representation of an IP address.

timeout
Int32 Int32 Int32 Int32

The maximum number of milliseconds (after sending the echo message) to wait for the ICMP echo reply message.

buffer
Byte[]

A Byte array that contains data to be sent with the ICMP echo message and returned in the ICMP echo reply message. The array cannot contain more than 65,500 bytes.

options
PingOptions PingOptions PingOptions PingOptions

A PingOptions object used to control fragmentation and Time-to-Live values for the ICMP echo message packet.

Returns

Returns Task<TResult>.

The task object representing the asynchronous operation.

Remarks

This operation will not block. The returned Task<TResult>> object will complete after the ICMP packet has been sent and the response has been received.

SendPingAsync(IPAddress) SendPingAsync(IPAddress) SendPingAsync(IPAddress) SendPingAsync(IPAddress)

Send an Internet Control Message Protocol (ICMP) echo message with the specified data buffer to the computer that has the specified IPAddress, and receives a corresponding ICMP echo reply message from that computer as an asynchronous operation.

public:
 System::Threading::Tasks::Task<System::Net::NetworkInformation::PingReply ^> ^ SendPingAsync(System::Net::IPAddress ^ address);
public System.Threading.Tasks.Task<System.Net.NetworkInformation.PingReply> SendPingAsync (System.Net.IPAddress address);
member this.SendPingAsync : System.Net.IPAddress -> System.Threading.Tasks.Task<System.Net.NetworkInformation.PingReply>
Public Function SendPingAsync (address As IPAddress) As Task(Of PingReply)
Parameters
address
IPAddress IPAddress IPAddress IPAddress

An IP address that identifies the computer that is the destination for the ICMP echo message.

Returns

Returns Task<TResult>.

The task object representing the asynchronous operation.

Exceptions

An exception was thrown while sending or receiving the ICMP messages. See the inner exception for the exact exception that was thrown.

address is not a valid IP address.

Remarks

This operation will not block. The returned Task<TResult>> object will complete after the ICMP packet has been sent and the response has been received.

SendPingAsync(String) SendPingAsync(String) SendPingAsync(String) SendPingAsync(String)

Sends an Internet Control Message Protocol (ICMP) echo message with the specified data buffer to the specified computer, and receive a corresponding ICMP echo reply message from that computer as an asynchronous operation.

public:
 System::Threading::Tasks::Task<System::Net::NetworkInformation::PingReply ^> ^ SendPingAsync(System::String ^ hostNameOrAddress);
public System.Threading.Tasks.Task<System.Net.NetworkInformation.PingReply> SendPingAsync (string hostNameOrAddress);
member this.SendPingAsync : string -> System.Threading.Tasks.Task<System.Net.NetworkInformation.PingReply>
Public Function SendPingAsync (hostNameOrAddress As String) As Task(Of PingReply)
Parameters
hostNameOrAddress
String String String String

The computer that is the destination for the ICMP echo message. The value specified for this parameter can be a host name or a string representation of an IP address.

Returns

Returns Task<TResult>.

The task object representing the asynchronous operation.

Remarks

This operation will not block. The returned Task<TResult>> object will complete after the ICMP packet has been sent and the response has been received.

SendPingAsync(IPAddress, Int32) SendPingAsync(IPAddress, Int32) SendPingAsync(IPAddress, Int32) SendPingAsync(IPAddress, Int32)

Send an Internet Control Message Protocol (ICMP) echo message with the specified data buffer to the computer that has the specified IPAddress, and receives a corresponding ICMP echo reply message from that computer as an asynchronous operation. This overload allows you to specify a time-out value for the operation.

public:
 System::Threading::Tasks::Task<System::Net::NetworkInformation::PingReply ^> ^ SendPingAsync(System::Net::IPAddress ^ address, int timeout);
public System.Threading.Tasks.Task<System.Net.NetworkInformation.PingReply> SendPingAsync (System.Net.IPAddress address, int timeout);
member this.SendPingAsync : System.Net.IPAddress * int -> System.Threading.Tasks.Task<System.Net.NetworkInformation.PingReply>
Public Function SendPingAsync (address As IPAddress, timeout As Integer) As Task(Of PingReply)
Parameters
address
IPAddress IPAddress IPAddress IPAddress

An IP address that identifies the computer that is the destination for the ICMP echo message.

timeout
Int32 Int32 Int32 Int32

The maximum number of milliseconds (after sending the echo message) to wait for the ICMP echo reply message.

Returns

Returns Task<TResult>.

The task object representing the asynchronous operation.

Remarks

This operation will not block. The returned Task<TResult>> object will complete after the ICMP packet has been sent and the response has been received.

SendPingAsync(String, Int32) SendPingAsync(String, Int32) SendPingAsync(String, Int32) SendPingAsync(String, Int32)

Sends an Internet Control Message Protocol (ICMP) echo message with the specified data buffer to the specified computer, and receive a corresponding ICMP echo reply message from that computer as an asynchronous operation. This overload allows you to specify a time-out value for the operation.

public:
 System::Threading::Tasks::Task<System::Net::NetworkInformation::PingReply ^> ^ SendPingAsync(System::String ^ hostNameOrAddress, int timeout);
public System.Threading.Tasks.Task<System.Net.NetworkInformation.PingReply> SendPingAsync (string hostNameOrAddress, int timeout);
member this.SendPingAsync : string * int -> System.Threading.Tasks.Task<System.Net.NetworkInformation.PingReply>
Public Function SendPingAsync (hostNameOrAddress As String, timeout As Integer) As Task(Of PingReply)
Parameters
hostNameOrAddress
String String String String

The computer that is the destination for the ICMP echo message. The value specified for this parameter can be a host name or a string representation of an IP address.

timeout
Int32 Int32 Int32 Int32

The maximum number of milliseconds (after sending the echo message) to wait for the ICMP echo reply message.

Returns

Returns Task<TResult>.

The task object representing the asynchronous operation.

Remarks

This operation will not block. The returned Task<TResult>> object will complete after the ICMP packet has been sent and the response has been received.

SendPingAsync(IPAddress, Int32, Byte[]) SendPingAsync(IPAddress, Int32, Byte[]) SendPingAsync(IPAddress, Int32, Byte[]) SendPingAsync(IPAddress, Int32, Byte[])

Send an Internet Control Message Protocol (ICMP) echo message with the specified data buffer to the computer that has the specified IPAddress, and receives a corresponding ICMP echo reply message from that computer as an asynchronous operation. This overload allows you to specify a time-out value for the operation and a buffer to use for send and receive.

public:
 System::Threading::Tasks::Task<System::Net::NetworkInformation::PingReply ^> ^ SendPingAsync(System::Net::IPAddress ^ address, int timeout, cli::array <System::Byte> ^ buffer);
public System.Threading.Tasks.Task<System.Net.NetworkInformation.PingReply> SendPingAsync (System.Net.IPAddress address, int timeout, byte[] buffer);
member this.SendPingAsync : System.Net.IPAddress * int * byte[] -> System.Threading.Tasks.Task<System.Net.NetworkInformation.PingReply>
Public Function SendPingAsync (address As IPAddress, timeout As Integer, buffer As Byte()) As Task(Of PingReply)
Parameters
address
IPAddress IPAddress IPAddress IPAddress

An IP address that identifies the computer that is the destination for the ICMP echo message.

timeout
Int32 Int32 Int32 Int32

The maximum number of milliseconds (after sending the echo message) to wait for the ICMP echo reply message.

buffer
Byte[]

A Byte array that contains data to be sent with the ICMP echo message and returned in the ICMP echo reply message. The array cannot contain more than 65,500 bytes.

Returns

Returns Task<TResult>.

The task object representing the asynchronous operation.

Exceptions

An exception was thrown while sending or receiving the ICMP messages. See the inner exception for the exact exception that was thrown.

address is not a valid IP address.

The size of buffer exceeds 65,500 bytes.

Remarks

This operation will not block. The returned Task<TResult>> object will complete after the ICMP packet has been sent and the response has been received.

SendPingAsync(String, Int32, Byte[]) SendPingAsync(String, Int32, Byte[]) SendPingAsync(String, Int32, Byte[]) SendPingAsync(String, Int32, Byte[])

Sends an Internet Control Message Protocol (ICMP) echo message with the specified data buffer to the specified computer, and receive a corresponding ICMP echo reply message from that computer as an asynchronous operation. This overload allows you to specify a time-out value for the operation and a buffer to use for send and receive.

public:
 System::Threading::Tasks::Task<System::Net::NetworkInformation::PingReply ^> ^ SendPingAsync(System::String ^ hostNameOrAddress, int timeout, cli::array <System::Byte> ^ buffer);
public System.Threading.Tasks.Task<System.Net.NetworkInformation.PingReply> SendPingAsync (string hostNameOrAddress, int timeout, byte[] buffer);
member this.SendPingAsync : string * int * byte[] -> System.Threading.Tasks.Task<System.Net.NetworkInformation.PingReply>
Public Function SendPingAsync (hostNameOrAddress As String, timeout As Integer, buffer As Byte()) As Task(Of PingReply)
Parameters
hostNameOrAddress
String String String String

The computer that is the destination for the ICMP echo message. The value specified for this parameter can be a host name or a string representation of an IP address.

timeout
Int32 Int32 Int32 Int32

The maximum number of milliseconds (after sending the echo message) to wait for the ICMP echo reply message.

buffer
Byte[]

A Byte array that contains data to be sent with the ICMP echo message and returned in the ICMP echo reply message. The array cannot contain more than 65,500 bytes.

Returns

Returns Task<TResult>.

The task object representing the asynchronous operation.

Remarks

This operation will not block. The returned Task<TResult>> object will complete after the ICMP packet has been sent and the response has been received.

SendPingAsync(IPAddress, Int32, Byte[], PingOptions) SendPingAsync(IPAddress, Int32, Byte[], PingOptions) SendPingAsync(IPAddress, Int32, Byte[], PingOptions) SendPingAsync(IPAddress, Int32, Byte[], PingOptions)

Send an Internet Control Message Protocol (ICMP) echo message with the specified data buffer to the computer that has the specified IPAddress, and receives a corresponding ICMP echo reply message from that computer as an asynchronous operation. This overload allows you to specify a time-out value for the operation, a buffer to use for send and receive, and control fragmentation and Time-to-Live values for the ICMP echo message packet.

public:
 System::Threading::Tasks::Task<System::Net::NetworkInformation::PingReply ^> ^ SendPingAsync(System::Net::IPAddress ^ address, int timeout, cli::array <System::Byte> ^ buffer, System::Net::NetworkInformation::PingOptions ^ options);
public System.Threading.Tasks.Task<System.Net.NetworkInformation.PingReply> SendPingAsync (System.Net.IPAddress address, int timeout, byte[] buffer, System.Net.NetworkInformation.PingOptions options);
member this.SendPingAsync : System.Net.IPAddress * int * byte[] * System.Net.NetworkInformation.PingOptions -> System.Threading.Tasks.Task<System.Net.NetworkInformation.PingReply>
Public Function SendPingAsync (address As IPAddress, timeout As Integer, buffer As Byte(), options As PingOptions) As Task(Of PingReply)
Parameters
address
IPAddress IPAddress IPAddress IPAddress

An IP address that identifies the computer that is the destination for the ICMP echo message.

timeout
Int32 Int32 Int32 Int32

The maximum number of milliseconds (after sending the echo message) to wait for the ICMP echo reply message.

buffer
Byte[]

A Byte array that contains data to be sent with the ICMP echo message and returned in the ICMP echo reply message. The array cannot contain more than 65,500 bytes.

options
PingOptions PingOptions PingOptions PingOptions

A PingOptions object used to control fragmentation and Time-to-Live values for the ICMP echo message packet.

Returns

Returns Task<TResult>.

The task object representing the asynchronous operation.

Exceptions

An exception was thrown while sending or receiving the ICMP messages. See the inner exception for the exact exception that was thrown.

address is not a valid IP address.

The size of buffer exceeds 65,500 bytes.

Remarks

This operation will not block. The returned Task<TResult>> object will complete after the ICMP packet has been sent and the response has been received.

Applies to