Check the number of correctly received packets - Socket Programming

I am writing an application in C using socket programming. I want to send data from a node server to a node client. I use read and write commands in the socket descriptor to receive and send data over the network, respectively. Since TCP / IP is used as the base protocol, I finally get the correct data. Is it possible to check on the client side that it is correct to receive data, how many packets were actually lost and retransmitted? I am writing this application in a Linux environment (debian).

Any help is much appreciated!

-Rahulkumar

+4
source share
1 answer

/proc/net/tcp has a retrnsmt field, you just need to find the socket in this list.

An alternative would be to use TCP_INFO sockopt . The current location of struct tcp_info can be found in linux / tcp.h. The field you want to use is probably tcpi_retrans .

+6
source

All Articles