Appendix - Winsock error codes

Most functions in Winsock will return an error code if the call has failed for some reason. It is a good idea to write error handling in to your code as problems can easily arise that can be easily corrected if you know what has gone wrong. Following is a list of Winsock error codes for your convenience.

Winsock error codes

10004WSAEINTRInterrupted function call
10009WSAEBADFWSAEBADF
10013WSAEACCESWSAEACCES
10014WSAEFAULTBad address
10022WSAEINVALInvalid argument
10024WSAEMFILEToo many open files
10035WSAEWOULDBLOCKOperation would block
10036WSAEINPROGRESSOperation now in progress
10037WSAEALREADYOperation already in progress
10038WSAENOTSOCKSocket operation on non-socket
10039WSAEDESTADDRREQDestination address required
10040WSAEMSGSIZEMessage too long
10041WSAEPROTOTYPEProtocol wrong type for socket
10042WSAENOPROTOOPTBad protocol option
10043WSAEPROTONOSUPPORTProtocol not supported
10044WSAESOCKTNOSUPPORTSocket type not supported
10045WSAEOPNOTSUPPOperation not supported
10046WSAEPFNOSUPPORTProtocol family not supported
10047WSAEAFNOSUPPORTAddress family not supported by protocol family
10048WSAEADDRINUSEAddress already in use
10049WSAEADDRNOTAVAILCannot assign requested address
10050WSAENETDOWNNetwork is down
10051WSAENETUNREACHNetwork is unreachable
10052WSAENETRESETNetwork dropped connection on reset
10053WSAECONNABORTEDSoftware caused connection abort
10054WSAECONNRESETConnection reset by peer
10055WSAENOBUFSNo buffer space available
10056WSAEISCONNSocket is already connected
10057WSAENOTCONNSocket is not connected
10058WSAESHUTDOWNCannot send after socket shutdown
10059WSAETOOMANYREFSWSAETOOMANYREFS
10060WSAETIMEDOUTConnection timed out
10061WSAECONNREFUSEDConnection refused
10062WSAELOOPWSAELOOP
10063WSAENAMETOOLONGWSAENAMETOOLONG
10064WSAEHOSTDOWNHost is down
10065WSAEHOSTUNREACHNo route to host
10066WSAENOTEMPTYWSAENOTEMPTY
10067WSAEPROCLIMToo many processes
10068WSAEUSERSWSAEUSERS
10069WSAEDQUOTWSAEDQUOT
10070WSAESTALEWSAESTALE
10071WSAEREMOTEWSAEREMOTE
10091WSASYSNOTREADYNetwork subsystem is unavailable
10092WSAVERNOTSUPPORTEDWINSOCK.DLL version out of range
10093WSANOTINITIALISEDSuccessful WSAStartup() not yet performed
10101WSAEDISCONWSAEDISCON
10102WSAENOMOREWSAENOMORE
10103WSAECANCELLEDWSAECANCELLED
10104WSAEINVALIDPROCTABLEWSAEINVALIDPROCTABLE
10105WSAEINVALIDPROVIDERWSAEINVALIDPROVIDER
10106WSAEPROVIDERFAILEDINITWSAEPROVIDERFAILEDINIT
10107WSASYSCALLFAILUREWSASYSCALLFAILURE
10108WSASERVICE_NOT_FOUNDWSASERVICE_NOT_FOUND
10109WSATYPE_NOT_FOUNDWSATYPE_NOT_FOUND
10110WSA_E_NO_MOREWSA_E_NO_MORE
10111WSA_E_CANCELLEDWSA_E_CANCELLED
10112WSAEREFUSEDWSAEREFUSED
11001WSAHOST_NOT_FOUNDHost not found
11002WSATRY_AGAINNon-authoritative host not found
11003WSANO_RECOVERYThis is a non-recoverable error
11004WSANO_DATAValid name, no data record of requested type


Back to tutorial index