This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: socket() function fails when application runs as an NT service.


"Warren Young" <warren@etr-usa.com> wrote:
> 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
> successful call.

Since, as you say, a frequent reason to use Cygwin is for Posix
compatibility, perhaps it might be better to use the standard `errno'
variable, which Cygwin sets as appropriate from the value of
WSAGetLastError() for socket calls.  This too can be set to 0 before a
call and checked afterwards in just the same manner as you describe for
the winsock interfaces.

HTH,

// Conrad



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]