Address: http://hi.baidu.com/roxws/item/914b52e8586aad0865db00e9
Other references: http://simohayha.iteye.com/blog/559506
Eagain error: this error is generally caused by non-blocking port read/write.
1. Sending: The remaining space in the sending buffer is smaller than the size of the sending package. You can modify tcp_sendspace to make it greater than the size parameter --- no-p-o tcp_sendspace = 65536 in send.
2. Receiving: The errno code is 11, which is an exception. Wait for the read to be triggered again.
Eintr: errno = 4. Error Description: interrupted system call. The operation should continue.
Econnaborted
This error is described as "software caused connection abort", that is, "software-caused connection suspension ". The reason is that when the service and the customer process complete the "three-way handshake" for the TCP connection, the customer TCP sends an RST (reset) shard. In the view of the service process, the connection is queued by TCP, but the RST is reached when the service process calls accept. POSIX specifies that the errno value at this time must be econnaborted. The implementation originating from Berkeley completely processes the aborted connection in the kernel, and the service process will never know the occurrence of the aborted connection. Generally, the server process can ignore this error and directly call accept again.
The econnreset is not in the RST received by tcp_syn_sent status.
This error is described as "Connection reset by peer", that is, "Reset connection of the other party". This usually occurs when the service process is terminated earlier than the customer process. When a service process is terminated, it will send a fin Shard to the customer TCP. The customer TCP responds to ack and the service TCP will be transferred to the fin_wait2 status. At this time, if the customer process does not process the fin (such as blocking other calls without closing the socket), the customer TCP will be in the close_wait state. When the customer process sends data to the fin_wait2 service TCP again, the Service
TCP will immediately respond to rst. In general, this situation can also lead to another application exception. After a customer process sends data, it often waits for the network Io to receive data, such as read or Readline calls, in this case, due to the execution sequence, if the call is executed before the RST node is received, the customer process will receive an unexpected EOF error. In this case, the error "server terminated prematurely"-"server premature termination" is usually output.
Epipe
The error is described as "Broken pipe", that is, "pipeline cracking". This usually happens when the customer process ignores (or fails to handle it in time) the socket error, when more data is written to the service TCP, the kernel sends the sigpipe signal to the client process. By default, the process is terminated (at this time, the front-end process does not perform core dump ). According to the preceding econnreset error, writing data to a fin_wait2 service TCP (with an ACK response to the fin shard) is not a problem, but writing a socket that has received the RST is an error.
Econnrefused
The RST received in the tcp_syn_sent status usually indicates that the other party does not have the corresponding listening service.
Etimedout
The error is described as "Connect Time Out", that is, "connection timeout". This usually occurs when the server host crashes. At this time, the customer TCP will continuously resend the data shard within a certain period of time (according to the specific implementation), trying to get an ACK shard from the service TCP. After the attempt is finally abandoned (the server is not restarted at this time), the kernel will return the etimedout error to the client process. If an intermediate router determines that the server host is no longer reachable, it will generally respond to the "Destination Unreachable"-"Destination inaccessible" ICMP message. The error returned by the corresponding customer process is ehostunreach.
Or enetunreach. After the server is restarted, all the previous connection information does not exist because the TCP status is lost. In this case, the client will respond to the RST request. If the customer process is necessary to detect whether the server host is crashed and requires that the customer process detect the failure even if the customer process does not actively send data, other technologies are required, such as configuring the so_keepalive socket option, or implement some heartbeat functions.
Ehosttunreach enetunreach
No route to host (soft error) causes an ICMP error that is inaccessible to the destination (1) (3). The client will retry multiple times at a scheduled time, an error is returned after a certain number of times.
RST: Generation Condition:
1. If the server receives SYN but does not have the corresponding listening service, RST is returned. Then the client returnsEconnrefused: the three-way handshake fails.
2. TCP wants to cancel an existing connection. Recipient's returnEconnreset.
3. TCP receives a shard that does not have a connection at all. It may be because the server has restarted and the connection information has been lost. Recipient's returnEconnreset.