|
|
|
|
Winsock Error Codes - Return error codes by Windows Sockets API - The following is a list of error codes returned by the WSAGetLastErrorcall along with their descriptions
There are two kinds of errors in Windows Sockets: task-based (or thread-based) and socket-based. An application can retrieve the task-based error by calling
WSAGetLastError()www.sockets.com/winsock.htm#GetLastError
WSAStartup() www.sockets.com/winsock.htm#Startup is the only function that returns an actual error value, rather than simply indicating an error condition (function failure). |
|
|
This makes sense, since you can't call
WSAGetLastError() to retrieve the error value until
WSAStartup() succeeds since it will fail with
WSANOTINITIALISED
www.sockets.com/err_lst1.htm#SANOTINITIALISED
The macro for each WinSock API error is the equivalent BSD error's macro, with the three letters WSA prepended to it. So, for instance, the BSD manifest constant for the "would block" error was defined in the Berkeley Sockets ERRNO.H header file as: #define EWOULDBLOCK 35 and WINSOCK.H redefines it as: #define WSAEWOULDBLOCK (WSABASEERR+35) www.sockets.com/err_lst1.htm#WAEWOULDBLOCK
A few other (higher value) macros are entirely new to Windows Sockets.
They refer to error conditions unique to
Windows Sockets, such as invalid WinSock version requests, uninitialized
WinSock DLL access, or failed hostname resolution attempts. All of the Windows Sockets error values have macros defined for them in the WINSOCK.H header file. They all have a "WSA" prefix and their values are all biased by the WinSock API base error WSABASEERR (10000) value. See list of user-fixable errors
What Errors to Expect? Note that this specification defines a recommended set of error codes, and lists the possible errors which may be returned as a result of each function. It may be the case in some implementations that other Windows Sockets error codes will be returned in addition to those listed, and applications should be prepared to handle errors other than those enumerated under each API description. The specification is a common denominator among WinSock implementations. The errors it lists don't provide "fine resolution" in all cases, which means it doesn't account for some conditions that some network systems can detect. Finer resolution in error reporting is a double edged sword: with more accurate error values it's easier to diagnose problems when they occur, but it's also more difficult to write an application that can handle all contingencies.
The better prepared your application is for any error, the more gracefully you'll handle it, and the easier you'll make your job and the job of your support staff.
|
|
|
|
Can't find
what you want? Try Google... |
|
©Copyright June 2002 Permission to re-print, please click here
Suggestions or feed-back, please drop us a note | eMail CRM Freeware | This site>>eMail Bolts & Nuts Home | Guest Book | Refund Policy | Privacy Policy | Contact Us | Support | Purchase | Product Info | Quick Tour Minute Wisdom | Sun Tzu Art of War | Useful Sites | eMail Broadcast FAQ's | Art of eMail CRM | eMail Marketing Tips |