This is the mail archive of the cygwin@cygwin.com 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]

Re: data in socketpair() channel lost if writer closes or exits without shutting down


On Sun, Jul 15, 2001 at 10:52:20PM -0400, Jonathan Kamens wrote:
> >  Date: Fri, 13 Jul 2001 20:21:46 -0400
> >  From: Christopher Faylor <cgf@redhat.com>
> >  
> >  Thanks for the diagnosis.  Would you be willing to look at the
> >  Cygwin socket code and suggest a fix?
> 
> In yet another astounding piece of Windows brain-damage, the
> *documented* behavior of the Winsock closesocket call is that any data
> written to the socket that hasn't been read by the other end is lost,
> and thus a client *must* call shutdown on a socket before closing it
> to ensure that all data is transmitted to the other end.  The

Thanks for figuring that out. I would be very interested in this
piece of documentation. Could you give me a pointer?

The problem is, from what I read so far (which is basically the MSDN)
the default behaviour on closing a socket is to perform a graceful
shutdown with immediate return of the `closesocket' function (linger
"off"). I just have that page "Graceful Shutdown, Linger Options, and
Socket Closure" inside of MSDN, that's all.

Since Microsoft at least claims that linger "off" is a valid and
settable state, shouldn't we try a very simple solution first?
We could change the Cygwin internal `socket' function so that
we don't rely on the linger setting but set linger "off" explicitely
after the socket() call. We could even set it explicitely in
a WSADuplicateSocket/WSASocket action on fork.

Comments?

Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Developer                                mailto:cygwin@cygwin.com
Red Hat, Inc.

--
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/


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