3

ping doesn't return anything so what is it used for?

If a user wants to ping and check ping time for all peers, getpeerinfo can be used.

2
  • I think ping is a basic networking utility that would be expected to be included in all P2P software. getpeerinfo provides additional information that you may not be interested in if you are just looking at ping time. – Michael Folkson Jul 5 at 14:03
  • It does not have any arguments so that user can mention address of a node to ping, it does not return any details, so I am not sure why would someone use it. I could not understand this comment by Greg Maxwell. If Bitcoin Core does not ping all peers automatically every few seconds then maybe there are use cases for this RPC else it can only be used for spamming (assuming there are no rate limits) – Prayank Jul 5 at 15:01
4

The help text is your friend:

Requests that a ping be sent to all other nodes, to measure ping time.
Results provided in getpeerinfo, pingtime and pingwait fields are decimal seconds.
Ping command is handled in queue with all other commands, so it measures processing backlog, not just network ping

After you use ping, you may see a new field, pingwait, in the getpeerinfo output. This is the time for waiting for the ping response. You will also see pingtime being updated once the peer responds to the ping. The purpose is to get an update on the ping times since the ping time reported may have been measured a long time ago.

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.