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: <4096FDAA.48D577A2@hot.pl> Date: Tue, 04 May 2004 04:19:22 +0200 From: Jacek Trzmiel MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: shutdown( socket, SHUT_WR ) - unexpected behaviour References: <40941F92 DOT 1DDD3E67 AT hot DOT pl> <20040503114446 DOT GE2201 AT cygbert DOT vinschen DOT de> Content-Type: text/plain; charset=iso-8859-2 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes > I've tried your application and I'm not able to reproduce your problem. > The shutdown call does not influence sending the buffered data apparently. Thanks for info. > I've tested with Cygwin 1.5.9 and with a recent snapshot on XP SP1. > What's your system? Cygwin 1.5.9, Win2kSP2. I made additional test using winsock directly and got the same buggy result. So it doesn't look like bug in cygwin, but rather in windows or some 3rd party app that is messing with the sockets (e.g. NIS). I found similar bugreport in MS KB298871, but it's marked as WinCE only: http://support.microsoft.com/default.aspx?scid=kb;en-us;298871 "If an application calls shutdown() to disable only sending from the socket, later attempts to read data sent to that socket will result in only portions of the data being received." Can somebody with Win2k box compile and run prog from my previous mail? I would like to know if it behaves incorrectly only on my system, or on Win2k in general: http://cygwin.com/ml/cygwin/2004-05/msg00013.html $ g++ ShutdownTest.cpp -o ShutdownTest && ./ShutdownTest.exe No output will mean that shutdown bug is present. > > 1. I suppose that shutdown(sd,SHUT_WR) does not force unflushed buffers > > out (i.e. discards them). Am I right? > > It doesn't flush, but it also doesn't stop the data already buffered > from being sent. It's only purpose is to disallow further send calls on > the socket. Yes, it works this way in practice (to have other reference, I've just tested in on FreeBSD). I was unsure only because unix documentation I found was silent about this. The only place I found now that declares it clearly is MSDN: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock/winsock/shutdown_2.asp "If the how parameter is SD_SEND, subsequent calls to the send function are disallowed. For TCP sockets, a FIN will be sent after all data is sent and acknowledged by the receiver." Regards, Jacek. -- 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/