When will my application receive SIGPIPE?

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a socket api?

528


What exactly is a socket?

524


What is the difference between SO_REUSEADDR and SO_REUSEPORT?

1354


What is socket address with example?

491


What are the types of sockets?

491






Why do I get EPROTO from read()?

1008


What is a sae socket?

512


Are sockets files?

500


Is a socket a file?

474


What is active unix domain sockets?

550


What is socket programming in java?

490


Where is the socket located?

474


How do I convert a string into an internet address?

906


How many socket connections can a server handle?

468


What is difference between socket and websocket?

484