Reputation: 243
I am using the System.Net.NetworkInformation library to ping an IP address to test connectivity. I am wondering how many attempts it will try before failing? For example, if you ping in CMD, it tries 4 times. Also if it tries multiple attempts, how does it declare success or failure when some fail and some pass?
I can't seem to find anything in the documentation.
Thanks in advance!
Upvotes: 0
Views: 1701
Reputation: 5862
The Ping.Send()
method will send a single buffer and wait for timeout.
As per that reference:
This method sends a 32 Byte data buffer with the ICMP echo message. The method waits five seconds for an ICMP echo reply message. If it does not receive a reply in that time, the method returns and the Status property is set to TimedOut.
So to directly answer your question, it'll be 1 attempt.
Upvotes: 6
Reputation: 6627
Each call to Ping.Send()
will send a single ICMP message and block until a response is received, an error occurs, or the timeout expires.
Upvotes: 2