delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/09/16/19:25:02

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Message-ID: <022d01c25dd8$afa80b20$6132bc3e@BABEL>
From: "Conrad Scott" <Conrad DOT Scott AT dsl DOT pipex DOT com>
To: <cygwin AT cygwin DOT com>
References: <Pine DOT GSO DOT 4 DOT 44 DOT 0209160238580 DOT 21486-100000 AT slinky DOT cs DOT nyu DOT edu> <012201c25d4e$4ba8ef70$010310ac AT lyoncleitienne> <3D866607 DOT 9040707 AT etr-usa DOT com>
Subject: Re: socket() function fails when application runs as an NT service.
Date: Tue, 17 Sep 2002 00:27:55 +0100
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106

"Warren Young" <warren AT etr-usa DOT 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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019