Subject: RE: recv and errno during a connection reset/closed by peer
From: "Peter Stephens" <[email-masked]>
To: "'Brian Ford'" <[email-masked]>
Cc: <[email-masked]>
Date: Wed, 30 Mar 2005 01:28:52 -0500

Brian,

I will look at this also.  I appreciated all of the suggestions, but really
just wanted to understand why Cygwin and Linux would be different in this
area.

The original reason behind posting to this group was because I believed that
my install of Cygwin was not following the SusV3 spec.  I'm still not really
convinced it does, but that may be because the spec seems vague to me about
the return when using MSG_PEEK.  Perhaps it is not supposed to follow SusV3?

I believed that there were several options to accomplish my task including:
poll, select, MSG_PEEK, and non-blocking.  While investigating all of these
to determine the best one I noticed this difference between the Linux and
Cygwin networking.  I think they both aim to follow the same SusVx spec.  Is
that not true?  If so, someone interpreted it differently or couldn't follow
the correct implementation for some reason.

Thanks

Peter A. Stephens
[email-masked]

-----Original Message-----
From: Brian Ford [mailto:[email-masked]] 
Sent: Tuesday, March 29, 2005 11:36 AM
To: Peter Stephens
Cc: [email-masked]
Subject: RE: recv and errno during a connection reset/closed by peer

On Mon, 28 Mar 2005, Peter Stephens wrote:

> Brian
>
> Are you saying that there is no way to distinguish a dropped 
> connection from a MSG_PEEK with no data to retrieve?

AFAIK, yes.  Why are you using this MSG_PEEK method?

Why not just do a poll and look for POLLHUP
(http://www.opengroup.org/onlinepubs/009695399/functions/poll.html):

POLLHUP
    The device has been disconnected. This event and POLLOUT are
mutually-exclusive; a stream can never be writable if a hangup has occurred.
However, this event and POLLIN, POLLRDNORM, POLLRDBAND, or POLLPRI are not
mutually-exclusive. This flag is only valid in the revents bitmask; it shall
be ignored in the events member.

and http://cygwin.com/acronyms/#PCYMTNQREAIYR ;-).

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