Hi,
In TCP protocol, it send the data to server and receive acknowledgement. if failed receive acknowledgement, then it will send again same data. it will try this for certain time. how can i control in socket created in linux? not seen any option in setsockopt function. is there any function exist to control this?
Look at the famous Beej's Guide to Network Programming. It is dedicated to Linux Socket programming although it can be easily changed into Windows it has all Linux Network Programming types
Thanks,
I read SO_RCVTIMEO and SO_SNDTIMEO can control timing. if this time expire, then crossponding sending or receiving will fail. it will try again. how can i control that try to connection. is there any option?
Hi,
in TCP once it send the packet and wait for acknowledge. if it is not receiving any ack, then it will send again data. after multiple attempts, it will show failed status. is there any way to control these multiple attempts?
As with so many things in Linux, this is explained in the man page
man tcp wrote:
These variables can be accessed by the /proc/sys/net/ipv4/* files or
with the sysctl(2) interface.
[...]
tcp_retries2 (integer; default: 15)
The maximum number of times a TCP packet is retransmitted in
established state before giving up. The default value is 15,
which corresponds to a duration of approximately between 13 to
30 minutes, depending on the retransmission timeout. The
RFC 1122 specified minimum limit of 100 seconds is typically
deemed too short.
Even open source has documentation: man 7 tcp describes the purpose of tcp_retries1 and tcp_retries2, and man 2 sysctl explains how to call sysctl, if you have to.
The only source code file you need to see is /usr/include/linux/sysctl.h to learn that tcp_retries2 is known to sysctl as NET_IPV4_TCP_RETRIES2