I understand that for TCP sockets ECONNRESET has got something to do with RST packets. But I've seen ECONNRESET errors for AF_LOCAL sockets too, on read() and write() calls. What does this mean? How is ECONNRESET different from read() returning 0 or write() throwing EPIPE?
相关问题
- Multiple sockets for clients to connect to
- Is shmid returned by shmget() unique across proces
- Drakma and Dexador both fails at USocket call whil
- difference between file descriptor and socket file
- Can we create a Silverlight Socket Server ONLY usi
相关文章
- What does it take to be durable on Linux?
- socket() returns 0 in C client server application
- Passing extra metadata to a RequestHandler using p
- How do I get the external IP of a socket in Python
- Native hooking in Android Client
- Is zeroing out the “sockaddr_in” structure necessa
- Does the TCPServer + BaseRequestHandler in Python&
- Is it possible to convert between Socket and TcpCl
It would appear that ECONNRESET means that the other side has closed the connection without reading outstanding data that has been sent to it, and can be triggered on both read() and write(). But the exact behavior depends on the operating system.
EPIPE
Seems to be triggered when one write()s to a socket that has already been closed, and there is no outstanding outgoing data. Applicable to both PF_LOCAL and TCP sockets. Example (Ruby):
read() returning 0
Triggered when the other side has closed the connection, and there is no outstanding outgoing data. Applicable to both PF_LOCAL and TCP sockets.
ECONNRESET
On Linux it behaves like this:
Triggered when there's outstanding outgoing data that has not yet been written to the other side. read() triggers it for both PF_LOCAL and TCP sockets, but write() triggers it only for TCP sockets; PF_LOCAL sockets trigger EPIPE.
See examples for specific OS behavior. Please contribute if you know how other OSes behave.
Example 1: read() on PF_LOCAL socket
Example 2: read() on TCP socket
Example 3: write() on PF_LOCAL socket
Example 4: write() on TCP socket