Annotation of mstools/samples/nwlink/testlib/errmsg.c, revision 1.1.1.1

1.1       root        1: /****************************************************************************\
                      2: *  errmsg.c -- sample program demonstrating NWLink.
                      3: *
                      4: *       Original code from Micro Computer Systems, Inc.
                      5: *       Copyright(c) 1992  All Rights Reserved.
                      6: *       Microsoft Developer Support
                      7: *       Copyright (c) 1992, 1993 Microsoft Corporation
                      8: *
                      9: *  Demonstrates basic sockets programming with the Windows Sockets API
                     10: *  using the NWLink transport.
                     11: * 
                     12: ****************************************************************************/
                     13: #include <winsock.h>
                     14: #include "externs.h"
                     15: 
                     16: /*
                     17: *   Messages we return if there was no error or we didn't have it
                     18: *   in our list.
                     19: */
                     20: 
                     21: char msg_no_error[19] =      "No error occurred!";
                     22: char msg_unknown_error[14] = "Unknown error";
                     23: 
                     24: /*
                     25: *   Error structures - Windows error number (from winsock.h) and
                     26: *   the corresponding description string.
                     27: */
                     28: 
                     29: ERROR_STRUCT errlist[] = {
                     30:     {WSAEINTR,           "WSAEINTR - Interrupted"},
                     31:     {WSAEBADF,          "WSAEBADF - Bad file number"},                    
                     32:     {WSAEFAULT,         "WSAEFAULT - Bad address"},          
                     33:     {WSAEINVAL,          "WSAEINVAL - Invalid argument"},          
                     34:     {WSAEMFILE,          "WSAEMFILE - Too many open files"},          
                     35: 
                     36: /*
                     37: *    Windows Sockets definitions of regular Berkeley error constants
                     38: */
                     39: 
                     40:     {WSAEWOULDBLOCK,    "WSAEWOULDBLOCK - Socket marked as non-blocking"},
                     41:     {WSAEINPROGRESS,     "WSAEINPROGRESS - Blocking call in progress"},
                     42:     {WSAEALREADY,        "WSAEALREADY - Command already completed"},
                     43:     {WSAENOTSOCK,        "WSAENOTSOCK - Descriptor is not a socket"},
                     44:     {WSAEDESTADDRREQ,    "WSAEDESTADDRREQ - Destination address required"},  
                     45:     {WSAEMSGSIZE,        "WSAEMSGSIZE - Data size too large"},     
                     46:     {WSAEPROTOTYPE,      "WSAEPROTOTYPE - Protocol is of wrong type for this socket"},   
                     47:     {WSAENOPROTOOPT,     "WSAENOPROTOOPT - Protocol option not supported for this socket type"},  
                     48:     {WSAEPROTONOSUPPORT, "WSAEPROTONOSUPPORT - Protocol is not supported"},
                     49:     {WSAESOCKTNOSUPPORT, "WSAESOCKTNOSUPPORT - Socket type not supported by this address family"},
                     50:     {WSAEOPNOTSUPP,      "WSAEOPNOTSUPP - Option not supported"},   
                     51:     {WSAEPFNOSUPPORT,    "WSAEPFNOSUPPORT - "}, 
                     52:     {WSAEAFNOSUPPORT,    "WSAEAFNOSUPPORT - Address family not supported by this protocol"},
                     53:     {WSAEADDRINUSE,      "WSAEADDRINUSE - Address is in use"},   
                     54:     {WSAEADDRNOTAVAIL,   "WSAEADDRNOTAVAIL - Address not available from local machine"},
                     55:     {WSAENETDOWN,        "WSAENETDOWN - Network subsystem is down"},     
                     56:     {WSAENETUNREACH,     "WSAENETUNREACH - Network cannot be reached"},  
                     57:     {WSAENETRESET,       "WSAENETRESET - Connection has been dropped"},    
                     58:     {WSAECONNABORTED,    "WSAECONNABORTED - "}, 
                     59:     {WSAECONNRESET,      "WSAECONNRESET - "},   
                     60:     {WSAENOBUFS,         "WSAENOBUFS - No buffer space available"},      
                     61:     {WSAEISCONN,         "WSAEISCONN - Socket is already connected"},      
                     62:     {WSAENOTCONN,        "WSAENOTCONN - Socket is not connected"},     
                     63:     {WSAESHUTDOWN,       "WSAESHUTDOWN - Socket has been shut down"},    
                     64:     {WSAETOOMANYREFS,    "WSAETOOMANYREFS - "}, 
                     65:     {WSAETIMEDOUT,       "WSAETIMEDOUT - Command timed out"},    
                     66:     {WSAECONNREFUSED,    "WSAECONNREFUSED - Connection refused"}, 
                     67:     {WSAELOOP,           "WSAELOOP - "},        
                     68:     {WSAENAMETOOLONG,    "WSAENAMETOOLONG - "}, 
                     69:     {WSAEHOSTDOWN,       "WSAEHOSTDOWN - "},    
                     70:     {WSAEHOSTUNREACH,    "WSAEHOSTUNREACH - "}, 
                     71:     {WSAENOTEMPTY,       "WSAENOTEMPTY - "},    
                     72:     {WSAEPROCLIM,        "WSAEPROCLIM - "},     
                     73:     {WSAEUSERS,          "WSAEUSERS - "},       
                     74:     {WSAEDQUOT,          "WSAEDQUOT - "},       
                     75:     {WSAESTALE,          "WSAESTALE - "},       
                     76:     {WSAEREMOTE,         "WSAEREMOTE - "},      
                     77:                         
                     78: /*
                     79: *    Extended Windows Sockets error constant definitions
                     80: */
                     81: 
                     82:     {WSASYSNOTREADY,     "WSASYSNOTREADY - Network subsystem not ready"},  
                     83:     {WSAVERNOTSUPPORTED, "WSAVERNOTSUPPORTED - Version not supported"},
                     84:     {WSANOTINITIALISED,  "WSANOTINITIALISED - WSAStartup() has not been successfully called"},
                     85: 
                     86: /*
                     87: *    Other error constants.
                     88: */
                     89:  
                     90:     {WSAHOST_NOT_FOUND,  "WSAHOST_NOT_FOUND - Host not found"},
                     91:     {WSATRY_AGAIN,       "WSATRY_AGAIN - Host not found or SERVERFAIL"},
                     92:     {WSANO_RECOVERY,     "WSANO_RECOVERY - Non-recoverable error"},
                     93:     {WSANO_DATA,         "WSANO_DATA - (or WSANO_ADDRESS) - No data record of requested type"},
                     94:     {-1,                NULL}
                     95: };

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.