Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , 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" To: References: <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 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 "Warren Young" 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/