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: <012201c25d4e$4ba8ef70$010310ac@lyoncleitienne> From: "Christophe LEITIENNE" To: References: Subject: Re: socket() function fails when application runs as an NT service. Date: Mon, 16 Sep 2002 08:57:13 +0200 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.2600.0000 > On Sun, 15 Sep 2002, Tom Cashmore wrote: > > Hi im having a strange problem with an application im writing using cygwin > (v1.3.12-1 On win2k Sp3). If the application is run as a console app (Ie > started from a cmd window) its able to open sockets (socket function returns > a valid handle) but when the application is run as an NT service it is > unable to succesfuly open sockets (Ie the socket function returns 0). Even > if i place a socket function before the call to StartServiceCtrlDispatcher > the socket function will still return a 0. This happens with the service > running as both system and local admin. Im pretty much stumped and am hoping > that someone else may have been able to resolve this problem in the past. > Any help would be greatly appreciated. Thank you. > > Tom Cashmore I think 0 is a valid socket descriptor. -1 is not. May be in a service there is no console, so descriptors 0, 1 and 2 are closed, and the first new descriptor is 0. Christophe LEITIENNE. -- 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/