← Back to context

Comment by jacquesm

13 hours ago

It'd be clever to integrate this into the TCP stack so it tells you immediately what the lowest bound is on the distance to the counterparty based on the time between data sent and the corresponding acknowledgements. I can see some immediate applications for that.

You can get tcp measured round trip time from tcp_info with

   struct tcp_info info;
   socklen_t len = sizeof(info);
   getsockopt(sock, IPPROTO_TCP, TCP_INFO, &info, &len);

tcp_info varies by OS and version, but I think tcpi_rtt is well supported.