2015-12-21 80 views
1

我使用boost :: ASIO在Linux上發送HTTP請求,使用幾乎一模一樣的代碼boost asio httperrno.h中插座/連接錯誤分類

我要趕例外,並errno.h中的錯誤代碼把它們歸類到三個組

GROUP 1.由於本地主機套接字/連接而發生錯誤。

GROUP 2.由於本地主機或遠程主機或第三方發生錯誤。

GROUP 3.由於遠程主機套接字/連接而發生錯誤 。

Error codes + errno.h define

我設法分類(林不知道這件事)

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. 

集團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 */ 

我希望你能幫助我找到在組不正確的錯誤代碼或添加錯誤代碼,我錯過的組。

回答

1

組2:

EAGAIN/EWOULDBLOCK 

組3:

ECONNRESET