Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Date: Tue, 29 Mar 2005 10:50:31 -0600
From: Brian Ford <ford@vss.fsi.com>
Reply-To: cygwin@cygwin.com
To: Peter Stephens <ptfoof@sbcglobal.net>
cc: "'Peter A. Castro'" <doctor@fruitbat.org>, cygwin@cygwin.com
Subject: RE: recv and errno during a connection reset/closed by peer
In-Reply-To: <!~!UENERkVCMDkAAQACAAAAAAAAAAAAAAAAABgAAAAAAAAAUKQItienSEKG+9226yKd5cKAAAAQAAAAng309fJS5U24MEanjzM6UgEAAAAA@sbcglobal.net>
Message-ID: <Pine.CYG.4.58.0503291046020.3732@fordpc.vss.fsi.com>
References: <!~!UENERkVCMDkAAQACAAAAAAAAAAAAAAAAABgAAAAAAAAAUKQItienSEKG+9226yKd5cKAAAAQAAAAng309fJS5U24MEanjzM6UgEAAAAA@sbcglobal.net>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
X-OriginalArrivalTime: 29 Mar 2005 16:50:34.0019 (UTC) FILETIME=[6CC3CF30:01C5347F]

On Mon, 28 Mar 2005, Peter Stephens wrote:

> FYI - I tried setting the SO_LINGER and the SO_RCVTIMEO on Linux and on
> Cygwin (see code below).  It makes sense to me that if the timeout has been
> exceeded then the recv(..., MSG_PEEK) should do something.  On Cygwin it
> doesn't do anything.

I don't have time to check, but I imagine this is just a
http://cygwin.com/acronyms/#PTC.

> On Linux it DOES time out, but it returns -1 and errno=EAGAIN.  This is an
> interesting choice for errno

Yes, it is the correct one.

> (perhaps ECONNABORTED, ESHUTDOWN, ECOMM,

definately not.  Just because a recv timed out doesn't mean the connection
is closed.

> ETIME, ETIMEDOUT,

Maybe.

> EHOSTUNREACH, or ENOLINK would have been better choices),

No as above.

> The spec is kinda vague about the response to a MSG_PEEK when the connection
> is lost, but I think that you could write a book on this subject with all
> the possible combinations.

Yup.  It's called "Unix Network Programming" by W. Richard Stevens ;-).

-- 
Brian Ford
Senior Realtime Software Engineer
VITAL - Visual Simulation Systems
FlightSafety International
the best safety device in any aircraft is a well-trained pilot...

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

