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
How to find other end of unix socket connection?
What is a socket api?
Is tcp or unix socket faster?
What is difference between socket () and serversocket () class?
Is there any advantage to handling the signal, rather than just ignoring it and checking for the EPIPE error? Are there any useful parameters passed to the signal catching function?
What is a socket set used for?
What is a sae socket?
What is the function of socket?
How can I write a multi-homed server?
What is a socket connection?
system choose one for me on the connect() call? Should I bind() a port number in my client program, or let the?
Why do we need socket programming?
How does a socket work?
What's better 6pt or 12pt sockets?
What is the difference between read() and recv()?