This is the mail archive of the 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.

>> On Sun, 15 Sep 2002, Tom Cashmore wrote:
>>   Hi im having a strange problem with an application im writing using
>> (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
>> 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).
>> if i place a socket function before the call to
>> 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
>> 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.

  Your correct 0 is a valid handle. After modifing the source to consider 0
a valid handle it now connects correctly. I guess i should have read the man
page a little more closely. Thank you for you help. 

  Tom Cashmore

Unsubscribe info:
Bug reporting:

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