When will my application receive SIGPIPE?



When will my application receive SIGPIPE?..

Answer / chaitanya

Very simple: with TCP you get SIGPIPE if your end of the connection has received an RST from the other end. What this also means is that if you were using select instead of write, the select would have indicated the socket as being readable, since the RST is there for you to read (read will return an error with errno set to ECONNRESET).

Basically an RST is TCP's response to some packet that it doesn't expect and has no other way of dealing with. A common case is when the peer closes the connection (sending you a FIN) but you ignore it because you're writing and not reading. (You should be using select.) So you write to a connection that has been closed by the other end and the oether end's TCP responds with an RST.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Unix Socket Programming Interview Questions

What is difference between socket and websocket?

0 Answers  


How does unix socket work?

0 Answers  


What is Mac, and how is it different from PC? Which one is better for professional users, and why

1 Answers   Evolving Systems, IBM,


What pieces of information make up a socket?

0 Answers  


How would I put my socket in non-blocking mode?

1 Answers  






What exactly is a socket?

0 Answers  


How do I use TCP_NODELAY?

0 Answers  


Why do we need socket programming?

0 Answers  


How do I send [this] over a socket?

1 Answers  


Can multiple clients connect to same socket?

0 Answers  


of the socket? Does doing a connect() call affect the receive behaviour?

1 Answers  


over the socket? Is there a way to have a dynamic buffer? What does one do when one does not know how much information is coming?

1 Answers  


Categories