-2

TCP can detect whether a packet was sent successfully anyways so instead of waiting for the pong, why not just check if there's an error when the ping is sent? I just don't find the need for pong.

1 Answers1

2

Having ping and pong creates an end-to-end test for both connectivity and a functional endpoint at the other end.

Using just TCP, only confirms that the TCP stack says the packet was delivered to the next stop in a potential connectivity chain and does not confirm that the other endpoint is actually functioning (only that the packet was delivered to the TCP stack).

This is particularly important when there are proxies or other intermediaries in the networking chain between endpoints which is very often the case in professionally hosted environments. Only a ping and pong confirms that the entire end-to-end chain, including both client and server are fully functioning.

Here's a related answer: WebSockets ping/pong, why not TCP keepalive?

jfriend00
  • 683,504
  • 96
  • 985
  • 979