Attempts to send 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.
This overload allows you to specify a time-out value for the operation and control fragmentation and Time-to-Live values for the ICMP packet.
| C# | Visual Basic |
public PingReply Send( string hostNameOrAddress, int timeout, byte[] buffer, PingOptions options )
Public Function Send ( _ hostNameOrAddress As String, _ timeout As Integer, _ buffer As Byte(), _ options As PingOptions _ ) As PingReply
- hostNameOrAddress (String)
- A String that identifies 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)
- An Int32 value that specifies the maximum number of milliseconds (after sending the echo message) to wait for the ICMP echo reply message.
- buffer (array<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)
- A PingOptions object used to control fragmentation and Time-to-Live values for the ICMP echo message packet.
A PingReply object that provides information about the ICMP echo reply message, if one was received, or provides the reason for the failure, if no message was received.
The method will return PacketTooBig if the packet exceeds the Maximum Transmission Unit (MTU).
| Exception | Condition |
|---|---|
| ArgumentNullException | hostNameOrAddress is a null reference (Nothing in Visual Basic).
-or- buffer is a null reference (Nothing in Visual Basic). |
| ArgumentOutOfRangeException | timeout is less than zero. |
| ArgumentException | The size of buffer exceeds 65500 bytes.
-or- address is not a valid IP address. |