1 /*
2
3 by Luigi Auriemma
4
5 */
6
7 #include <stdio.h>
8 #include <stdlib.h>
9 #include <string.h>
10
11 #ifdef WIN32
12 #include <winsock.h>
13 /*
14 Header file used for manage errors in Windows
15 It support socket and errno too
16 (this header replace the previous sock_errX.h)
17 */
18
19 #include <string.h>
20 #include <errno.h>
21
22
23
24 void std_err(void) {
25 char *error;
26
27 switch(WSAGetLastError()) {
28 case 10004: error = "Interrupted system call"; break;
29 case 10009: error = "Bad file number"; break;
30 case 10013: error = "Permission denied"; break;
31 case 10014: error = "Bad address"; break;
32 case 10022: error = "Invalid argument (not bind)"; break;
33 case 10024: error = "Too many open files"; break;
34 case 10035: error = "Operation would block"; break;
35 case 10036: error = "Operation now in progress"; break;
36 case 10037: error = "Operation already in progress"; break;
37 case 10038: error = "Socket operation on non−socket"; break;
38 case 10039: error = "Destination address required"; break;
39 case 10040: error = "Message too long"; break;
40 case 10041: error = "Protocol wrong type for socket"; break;
41 case 10042: error = "Bad protocol option"; break;
42 case 10043: error = "Protocol not supported"; break;
43 case 10044: error = "Socket type not supported"; break;
44 case 10045: error = "Operation not supported on socket"; break;
45 case 10046: error = "Protocol family not supported"; break;
46 case 10047: error = "Address family not supported by protocol family"; break;
47 case 10048: error = "Address already in use"; break;
48 case 10049: error = "Can’t assign requested address"; break;
49 case 10050: error = "Network is down"; break;
50 case 10051: error = "Network is unreachable"; break;
51 case 10052: error = "Net dropped connection or reset"; break;
52