I'm using recv function (C++) in order to get indication about network problem (it return negative value in this case)
Looking here: http://tools.ietf.org/html/rfc1122#page-100 at TCP Connection Failures, I see that there are R1 and R2.
R1 is when TCP informs application that there is a problem. R2 is when the connection is closed.
“The value of R1 SHOULD correspond to at least 3 retransmissions, at the current RTO. The value of R2 SHOULD correspond to at least 100 seconds.”
RTO (Retransmission Timeout) typically starts at 3 seconds, so for R1, it might be after about 10 seconds.
as far as I understand receive function will let me know about R2. Do you know about a way to get R1 in C++ application?
10x.
On most systems, recv() transmit informations by two means : the return code and by setting the global variable errno.
To know what is returned/set in each case, you have to look at the exact API of the recv() function.
Full doc :