|
Return error codes by Windows Sockets API
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
immediately after a WinSock function fails:
reported in a
WSAAsyncSelect()
www.sockets.com/winsock.htm#AsyncSelect
asynchronous FD_ event notification message (which you can extract with the platform independent "message cracker" macro
WSAGETSELECTERROR(lParam)).
retrieved by a call to
getsockopt() SO_ERROR (which also resets the error value to zero).
www.sockets.com/winsock.htm#GetSockOpt
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
Continue Next Page
Any feed-back or
suggestions?
Please
drop
us a note
Support | Purchase | Product
Info Quick Tour |
Art of eMail CRM
Home | Contact
Us | Guest Book
Useful
Sites |
eMail Marketing Tips |