ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
If there is an ESTABLISHED TCP socket over any interface, and the underlying interface is brought down (ifconfig <ifname> down), then the TCP keep-alive mechanism comes to rescue (this however requires turning on the SO_KEEPALIVE socket option). The keep-alive mechanism will probe whether the connection is alive or not after keepalive intervals. (configurable through /proc/sys/net/ipv4/tcp_keepalive_*). I have set the probes to 16 and interval as 1.
But if some data is pumped over this socket after bringing the interface down and when the probing mechanism is in progress, then it gets buffered in the TCP send queue and stays there till the connection breaks. My problem is that, in such scenario, the keep alive mechanism takes too long (say 15-20 mins with this configuration) to terminate the connection which would otherwise take a few seconds.
So, can anyone please let me know on how to get rid off the buffered bytes in the send queue and terminate the connection as per the configuration (keep alive probes and timeout interval).
Can you tell us what setting you used for tcp_keepalive_time ? .. this configures how many seconds to wait after the last data packet before sending any probes
The interval has been kept as 1 sec and number of probes as 16. These settings works fine if there is no data sent over the socket when the keep-alive mechanism is in progress. But as I have stated in my last post, as soon as the interface is brought down, some data is immediately sent over it which causes the problem. Hope I've made my point clear.