|
|
Winsock Error Codes - This Page 1/3 User Fixable Errors - There are two basic types of errors: those an application user can remedy, and those he cannot and a user should never see an error that is not user-fixable and list of user-fixable errors... Page 2/3 List of user-fixable errors - Continue - Page 3/3 |
RFC defined ESMTP Status Error Codes ESMTP Status Error Codes Command Group |
| |
Winsock Error Codes The following is a list of error codes returned by the WSAGetLastErrorcall along with their descriptionsThere 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 Windows Sockets does not support the Berkeley Sockets error variables errno or h_errno because these per-process global variables don't allow for per-thread error information. The WINSOCK.H header file provides a macro for h_errno for Berkeley source code compatibility--simply calls WSAGetLastError() The equivalent macro for errno wasn't included since some applications use errno for non-socket (e.g. file handle) errors. |
|
|
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 (lower value) WinSock error macro definitions refer to Microsoft C constants. In some cases, these redefine file access errors since Windows NT can treat a socket like a file handle. 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. |
Manage bounce Free2Try
Sun Tzu |
|
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. |
|
Any feed-back or suggestions?
Please
drop
us a note ©Copyright June 2002 Permission to re-print, please click here
|
Click button & YOU can ... |