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 difference between socket () and serversocket () class?

634


What are the pros/cons of select(), non-blocking I/O and SIGIO?

1111


Why does the sockets buffer fill up sooner than expected?

1122


What is a deep well socket?

693


What is sae socket?

599


What's the difference between a socket and a port?

613


What is a socket address?

686


system choose one for me on the connect() call? Should I bind() a port number in my client program, or let the?

1301


What's better 6pt or 12pt sockets?

612


Can a socket have multiple ports?

643


How can I force a socket to send the data in its buffer?

1266


Can multiple sockets use the same port?

642


How does a socket work?

635


How do I use TCP_NODELAY?

1249


Whats the difference between select() and poll()?

1379