[B20.1 Win95] Problem with socket() function call.

Andrew M. Bishop amb@gedanken.demon.co.uk
Sun Jan 31 23:52:00 GMT 1999


Warren Young wrote:
> >Is there any reason that the socket() function call should return
> >EINPROGRESS?
> 
> WSAEINPROGRESS (the properly decorated Winsock version of this error code)
> means "a blocking call is in progress".  It's an older error code from the
> Winsock 1.1 and Win16 days when blocking meant that Winsock would run a
> small message pump so one blocked app would not halt the entire system.

> depending on the fact that under WinNT, socket handles are inherited by
> child processes by default.  Unfortunately, a bug in Windows 95 (which you
> indicate that you're running) causes this to not be true; see MS knowledge
> base article Q150523 for details.  I don't know if this was fixed in
> Windows 98.
> 
> I suppose Cygwin could work around this with the WSADuplicateSocket() (or
> duplicate_handle() as it's wrapped internally) call, but that'd be messy
> /plus ultra/.

Cygwin already duplicates the handles when they are created with the
socket() function.  This should make them inheritable by the child.

>From looking at the supplied MS code in the knowledge base and the
code in the cygwin DLL I don't see that there is required to be any
more work.  The socket handle is the SOCKET value which is known in
the child because it was known in the parent.  The only problem seems
to be that the MS code says that the socket should be closed by the
parent *after* the child has exited and not before which is the UNIX
way.

> Anyway, the fix for your program is probably to do the WSADuplicateSocket
> stuff yourself or to upgrade to Windows NT.  

Upgrading to Windows NT is not an option since I am trying to port one
of my own UNIX programs to win95.

It is a proxy web server and mostly works on Windows 95.  The socket
inheritance *does* seem to work most of the time, there are just some
oddities at times, including this problem with socket() and also with
gethostbyname() if DNS is used.

-- 
Andrew.
----------------------------------------------------------------------
Andrew M. Bishop                             amb@gedanken.demon.co.uk
                                      http://www.gedanken.demon.co.uk/
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".



More information about the Cygwin mailing list