| 1 | /** \file socket_include.cpp |
|---|
| 2 | ** \date 2004-11-28 |
|---|
| 3 | ** \author grymse@alhem.net |
|---|
| 4 | **/ |
|---|
| 5 | /* |
|---|
| 6 | Copyright (C) 2004-2007 Anders Hedstrom |
|---|
| 7 | |
|---|
| 8 | This library is made available under the terms of the GNU GPL. |
|---|
| 9 | |
|---|
| 10 | If you would like to use this library in a closed-source application, |
|---|
| 11 | a separate license agreement is available. For information about |
|---|
| 12 | the closed-source license agreement for the C++ sockets library, |
|---|
| 13 | please visit http://www.alhem.net/Sockets/license.html and/or |
|---|
| 14 | email license@alhem.net. |
|---|
| 15 | |
|---|
| 16 | This program is free software; you can redistribute it and/or |
|---|
| 17 | modify it under the terms of the GNU General Public License |
|---|
| 18 | as published by the Free Software Foundation; either version 2 |
|---|
| 19 | of the License, or (at your option) any later version. |
|---|
| 20 | |
|---|
| 21 | This program is distributed in the hope that it will be useful, |
|---|
| 22 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 23 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 24 | GNU General Public License for more details. |
|---|
| 25 | |
|---|
| 26 | You should have received a copy of the GNU General Public License |
|---|
| 27 | along with this program; if not, write to the Free Software |
|---|
| 28 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|---|
| 29 | */ |
|---|
| 30 | #include <stdio.h> |
|---|
| 31 | |
|---|
| 32 | // only to be included in win32 projects |
|---|
| 33 | const char *StrError(int x) |
|---|
| 34 | { |
|---|
| 35 | static char tmp[100]; |
|---|
| 36 | switch (x) |
|---|
| 37 | { |
|---|
| 38 | case 10004: return "Interrupted function call."; |
|---|
| 39 | case 10013: return "Permission denied."; |
|---|
| 40 | case 10014: return "Bad address."; |
|---|
| 41 | case 10022: return "Invalid argument."; |
|---|
| 42 | case 10024: return "Too many open files."; |
|---|
| 43 | case 10035: return "Resource temporarily unavailable."; |
|---|
| 44 | case 10036: return "Operation now in progress."; |
|---|
| 45 | case 10037: return "Operation already in progress."; |
|---|
| 46 | case 10038: return "Socket operation on nonsocket."; |
|---|
| 47 | case 10039: return "Destination address required."; |
|---|
| 48 | case 10040: return "Message too long."; |
|---|
| 49 | case 10041: return "Protocol wrong type for socket."; |
|---|
| 50 | case 10042: return "Bad protocol option."; |
|---|
| 51 | case 10043: return "Protocol not supported."; |
|---|
| 52 | case 10044: return "Socket type not supported."; |
|---|
| 53 | case 10045: return "Operation not supported."; |
|---|
| 54 | case 10046: return "Protocol family not supported."; |
|---|
| 55 | case 10047: return "Address family not supported by protocol family."; |
|---|
| 56 | case 10048: return "Address already in use."; |
|---|
| 57 | case 10049: return "Cannot assign requested address."; |
|---|
| 58 | case 10050: return "Network is down."; |
|---|
| 59 | case 10051: return "Network is unreachable."; |
|---|
| 60 | case 10052: return "Network dropped connection on reset."; |
|---|
| 61 | case 10053: return "Software caused connection abort."; |
|---|
| 62 | case 10054: return "Connection reset by peer."; |
|---|
| 63 | case 10055: return "No buffer space available."; |
|---|
| 64 | case 10056: return "Socket is already connected."; |
|---|
| 65 | case 10057: return "Socket is not connected."; |
|---|
| 66 | case 10058: return "Cannot send after socket shutdown."; |
|---|
| 67 | case 10060: return "Connection timed out."; |
|---|
| 68 | case 10061: return "Connection refused."; |
|---|
| 69 | case 10064: return "Host is down."; |
|---|
| 70 | case 10065: return "No route to host."; |
|---|
| 71 | case 10067: return "Too many processes."; |
|---|
| 72 | case 10091: return "Network subsystem is unavailable."; |
|---|
| 73 | case 10092: return "Winsock.dll version out of range."; |
|---|
| 74 | case 10093: return "Successful WSAStartup not yet performed."; |
|---|
| 75 | case 10101: return "Graceful shutdown in progress."; |
|---|
| 76 | case 10109: return "Class type not found."; |
|---|
| 77 | case 11001: return "Host not found."; |
|---|
| 78 | case 11002: return "Nonauthoritative host not found."; |
|---|
| 79 | case 11003: return "This is a nonrecoverable error."; |
|---|
| 80 | case 11004: return "Valid name, no data record of requested type."; |
|---|
| 81 | |
|---|
| 82 | default: |
|---|
| 83 | break; |
|---|
| 84 | } |
|---|
| 85 | sprintf(tmp, "Winsock error code: %d", x); |
|---|
| 86 | return tmp; |
|---|
| 87 | } |
|---|
| 88 | |
|---|
| 89 | |
|---|
| 90 | |
|---|