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]
Other format: [Raw text]

Re: tcp RST instead of FIN if child exits after parent closes path


> > I don't follow.  The path is still open and able to send the data from the
> > child even though the parent has closed it.  It's only when the child exits
> > (note: the child just exited; it didn't do an explicit "close") that the
> > connection was killed, so there the system already knows when the last close
> > occurs.  What is being done to the socket that is different depending upon
> > whether the final close comes from the process that originally opened it or
> > another one?
> 
> I believe it is not which process does the final close that matters. Rather,
> I think that it is write-then-immediately-close that causes the RST. (At
> least with some socket options).

That wouldn't be the case with my example program because neither the parent
nor the child actually write anything to the socket.  They just hold it
open and then close them in different orders to show the different results.


> For detail, see MSDN. Look up the closesocket() function, and read that
> page, and also "Graceful Shutdown, Linger Options, and Socket Closure"
> linked to from that page.

I didn't explicitly set any options, so I assume CygWin used the default
WinSock option of SO_DONTLINGER which means, as I read the page, that it
should delay the close until all data has been sent/ack'd and then disconnect
in the background.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock/winsock/closesocket_2.asp

                                          Brian
                                 ( bcwhite at precidia dot com )

-------------------------------------------------------------------------------
"Everything that can be invented already has been."  --U.S. Patent Office, 1899

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.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]