This is the mail archive of the cygwin 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: shutdown( socket, SHUT_WR ) - unexpected behaviour


On May  2 00:07, Jacek Trzmiel wrote:
> 
> Hi,
> 
> $ cygcheck -cd cygwin       
> Cygwin Package Information
> Package              Version        
> cygwin               1.5.9-1        
> 
> I found some unexpected behaviour of shutdown call.  Here is example
> program to reproduce problem.  It is supposed to send simple http
> request to example.org, close writing part of socket, and then wait for
> and print reply:
> 
> --- ShutdownTest.cpp ------------------------------------------------
> [...]
> --- ShutdownTest.cpp ------------------------------------------------
> 
> If you compile and run it this way:
> $ g++ ShutdownTest.cpp -o ShutdownTest && ./ShutdownTest.exe
> 
> it doesn't print anything.   Commenting out shutdown call or adding some
> wait before it does make program work as expected:
> 
> $ g++ ShutdownTest.cpp -o ShutdownTest && ./ShutdownTest.exe
> HTTP/1.1 200 OK
> Date: Sat, 01 May 2004 23:28:20 GMT
> Server: Apache/1.3.27 (Unix)  (Red-Hat/Linux)
> Last-Modified: Wed, 08 Jan 2003 23:11:55 GMT
> [...]

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.

I've tested with Cygwin 1.5.9 and with a recent snapshot on XP SP1.
What's your system?

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


Corinna

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

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