Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
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.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have a process with multiple threads inside. In one of the threads(A), there is a TCP socket
connection towards a server. Data is being sent from the thread A towards this server. At one point of
time, server is down abruptly, which is detected by the thread A only after 15 minutes.
During this 15 minutes, the data sent by thread A, using unix command "send" are successful.
My queries
1. why, the "send" command doesn't fail immediately? Why it takes 15 minutes for this detection?
2. I tried to catch the signal SIGPIPE in thread A itself using signal function, but it doesn't work, which means "send"
command still is successfull?
3. Should the signals be catched at thread level or process level?
Your connection might have been buffering in which case you might want to set TCP_NODELAY on the socket, this is typically used in situations where each individual send is small but you want it sent right away instead of getting buffered before sending.
Does it still work, even if the Peer host itself crashes or unreachable? Assume, its not the case of Peer process crashing.
Because, in case TCP is actively sending data, in case of Peer host itself crashes or unreachable, TCP will time out(may be after 15 minutes), and socket's pending error is set to ETIMEDOUT.
Will this case, also be solved by using TCP_NODELAY?
Could you please clarify. Thanks!
raikme - yes if the peer has crashed you won't know it until bytes are actively sent so either when the keepalive timer kicks one out or your send fills its buffer and sends it out. The TCP_NODELAY tells send not to buffer but send out the data immediately, this should eliminate the delay of getting a SIGPIPE when the connection is down.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.