This is the mail archive of the
mailing list for the Cygwin project.
Re: socket() function fails when application runs as an NT service.
Christophe LEITIENNE wrote:
I think 0 is a valid socket descriptor. -1 is not.
It may also be helpful to call WSAGetLastError(). I realize that you're
probably running under Cygwin for POSIX compatibility, but adding this
temporarily to ask Winsock "why" it returned an error can be
illuminating. Since one possible result is "there is no error", you
will want to call WSASetLastError() with 0 to make sure you don't get an
older error code, since Winsock doesn't reset the error variable after a
= Winsock Programmer's FAQ: http://tangentsoft.net/wskfaq/
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html