• Main Page
  • Classes
  • Files
  • File List
  • File Members

Beesnest/Windows/DcSocketMessage.cpp

Go to the documentation of this file.
00001 /*
00002 Copyright 2007 Erez Bibi (erezbibi@users.sourceforge.net)
00003 This file is part of Beesnest.
00004 
00005 Beesnest is free software; you can redistribute it and/or modify
00006 it under the terms of the GNU General Public License as published by
00007 the Free Software Foundation; either version 2 of the License, or
00008 (at your option) any later version.
00009 
00010 Beesnest is distributed in the hope that it will be useful,
00011 but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 GNU General Public License for more details.
00014 
00015 You should have received a copy of the GNU General Public License
00016 along with Beesnest; if not, write to the Free Software
00017 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00018 */
00019 
00020 /**
00021  * This help function returns a message (string) for a Win32 Socket error code.
00022  */
00023 CdcString GetSocketErrorMsg (int code)
00024 {
00025     switch (code)
00026     {
00027     case WSAEINTR:
00028         return CdcString ("Interrupted function call");
00029     case WSAEBADF:
00030         return CdcString ("Bad file number");
00031     case WSAEACCES:
00032         return CdcString ("Permission denied");
00033     case WSAEFAULT:
00034         return CdcString ("Bad address");
00035     case WSAEINVAL:
00036         return CdcString ("Invalid argument");
00037     case WSAEMFILE:
00038         return CdcString ("Too many open sockets");
00039     case WSAEWOULDBLOCK:
00040         return CdcString ("Resource temporarily unavailable");
00041     case WSAEINPROGRESS:
00042         return CdcString ("Operation now in progress");
00043     case WSAEALREADY:
00044         return CdcString ("Operation already in progress");
00045     case WSAENOTSOCK:
00046         return CdcString ("Socket operation on non-socket");
00047     case WSAEDESTADDRREQ:
00048         return CdcString ("Destination address required ");
00049     case WSAEMSGSIZE:
00050         return CdcString ("Message too long");
00051     case WSAEPROTOTYPE:
00052         return CdcString ("Protocol wrong type for socket");
00053     case WSAENOPROTOOPT:
00054         return CdcString ("Bad protocol option");
00055     case WSAEPROTONOSUPPORT:
00056         return CdcString ("Protocol not supported");
00057     case WSAESOCKTNOSUPPORT:
00058         return CdcString ("Socket type not supported");
00059     case WSAEOPNOTSUPP:
00060         return CdcString ("Operation not supported");
00061     case WSAEPFNOSUPPORT:
00062         return CdcString ("Protocol family not supported");
00063     case WSAEAFNOSUPPORT:
00064         return CdcString ("Address family not supported by protocol family");
00065     case WSAEADDRINUSE:
00066         return CdcString ("Address already in use");
00067     case WSAEADDRNOTAVAIL:
00068         return CdcString ("Cannot assign requested address");
00069     case WSAENETDOWN:
00070          return CdcString ("Network is down");
00071     case WSAENETUNREACH:
00072         return CdcString ("Network is unreachable");
00073     case WSAENETRESET:
00074         return CdcString ("Network dropped connection on reset");
00075     case WSAECONNABORTED:
00076         return CdcString ("Software caused connection abort");
00077     case WSAECONNRESET:
00078         return CdcString ("Connection reset by peer");
00079     case WSAENOBUFS:
00080         return CdcString ("No buffer space available");
00081     case WSAEISCONN:
00082         return CdcString ("Socket is already connected");
00083     case WSAENOTCONN:
00084         return CdcString ("Socket is not connected");
00085     case WSAESHUTDOWN:
00086         return CdcString ("Cannot send after socket shutdown");
00087     case WSAETIMEDOUT:
00088         return CdcString ("Connection timed out");
00089     case WSAECONNREFUSED:
00090         return CdcString ("Connection refused");
00091     case WSAEHOSTDOWN:
00092         return CdcString ("Host is down");
00093     case WSAEHOSTUNREACH:
00094         return CdcString ("No route to host");
00095     case WSAEPROCLIM:
00096         return CdcString ("Too many processes");
00097     case WSASYSNOTREADY:
00098         return CdcString ("Network subsystem is unavailable");
00099     case WSAVERNOTSUPPORTED:
00100         return CdcString ("WINSOCK.DLL version out of range");
00101     case WSANOTINITIALISED:
00102         return CdcString ("Successful WSAStartup not yet performed");
00103     case WSAEDISCON:
00104         return CdcString ("shutdown in progress");
00105     case WSAHOST_NOT_FOUND:
00106         return CdcString ("Host not found");
00107     case WSATRY_AGAIN:
00108         return CdcString ("Non-authoritative host not found");
00109     case WSANO_RECOVERY:
00110         return CdcString ("This is a non-recoverable error");
00111     case WSANO_DATA:
00112         return CdcString ("Valid name, no data record of requested type");
00113 //  case WSA_INVALID_HANDLE:
00114 //      return CdcString ("Specified event object handle is invalid");
00115 //  case WSA_INVALID_PARAMETER:
00116 //      return CdcString ("One or more parameters are invalid");
00117 //  case WSAINVALIDPROCTABLE:
00118 //      return CdcString ("Invalid procedure table from service provider");
00119 //  case WSAINVALIDPROVIDER:
00120 //      return CdcString ("Invalid service provider version number");
00121 //  case WSA_IO_PENDING:
00122 //      return CdcString ("Overlapped operations will complete later");
00123 //  case WSA_IO_INCOMPLETE:
00124 //      return CdcString ("Overlapped I/O event object not in signaled state");
00125 //  case WSA_NOT_ENOUGH_MEMORY:
00126 //      return CdcString ("Insufficient memory available");
00127 //  case WSAPROVIDERFAILEDINIT:
00128 //      return CdcString ("Unable to initialize a service provider");
00129     case WSASYSCALLFAILURE:
00130         return CdcString ("System call failure");
00131 //  case WSA_OPERATION_ABORTED:
00132 //      return CdcString ("Overlapped operation aborted");
00133     default:
00134         char buff [40];
00135         sprintf (buff, "Unknown error - %d", code);
00136         return CdcString (buff);
00137     }
00138     return EMPTY_STR;
00139 }
00140 

Generated on Mon Oct 11 2010 16:23:25 for Beesnest by  doxygen 1.7.2