Skip to content
Advertisement

errno.h socket/connection error classification

I’m using boost::asio on linux to send http request, using almost exactly this code boost asio http

I want to catch exceptions and classify them using errno.h error codes to three groups

GROUP 1. errors occurred because of local host socket/connection.

GROUP 2. errors occurred because of local host or remote host or third party.

GROUP 3. errors occurred because of remote host socket/connection.

Error codes + errno.h define

What I managed to classify (Im not sure about it)

GROUP 1

#define ENETDOWN        100     /* Network is down */
#define ENETUNREACH     101     /* Network is unreachable */
#define ENETRESET       102     /* Network dropped connection because of reset */

GROUP 2

//Not sure.

GROUP 3

#define ETIMEDOUT       110     /* Connection timed out */
#define ECONNREFUSED    111     /* Connection refused */
#define EHOSTDOWN       112     /* Host is down */
#define EHOSTUNREACH    113     /* No route to host */

I hope you can help me find incorrect error codes in the groups or add error code i missed to the groups.

Advertisement

Answer

Group 2:

EAGAIN/EWOULDBLOCK

Group 3:

ECONNRESET
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement