delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/03/28/23:50:40

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
From: "Peter Stephens" <ptfoof AT sbcglobal DOT net>
To: "'Peter A. Castro'" <doctor AT fruitbat DOT org>
Cc: <cygwin AT cygwin DOT com>
Subject: RE: recv and errno during a connection reset/closed by peer
Date: Mon, 28 Mar 2005 23:55:33 -0500
Message-ID: <!~!UENERkVCMDkAAQACAAAAAAAAAAAAAAAAABgAAAAAAAAAUKQItienSEKG+9226yKd5cKAAAAQAAAAWaasRohYskqPu4Nwwl0kbwEAAAAA@sbcglobal.net>
MIME-Version: 1.0
In-Reply-To: <Pine.LNX.4.60.0503281549130.736@gremlin.fruitbat.org>

------=_NextPart_000_0000_01C533F1.A20022E0
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 7bit

 
Pete,

The most likely reason for the difference in Cygwin is,

"If you create a socket using the Winsock 2 WSASocket API and you need to
apply a timeout in receive or send operations on the socket, you must
specify the WSA_FLAG_OVERLAPPED flag in the WSASocket call."

From the MSDN website article
http://support.microsoft.com/default.aspx?scid=kb;en-us;181610.

Peter A. Stephens
ptfoof AT sbcglobal DOT net

-----Original Message-----
From: Peter A. Castro [mailto:doctor AT fruitbat DOT org] 
Sent: Monday, March 28, 2005 7:02 PM
To: Peter Stephens
Cc: cygwin AT cygwin DOT com
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?

As someone who's seen this behaviour on several platforms, it can happen.
I've had to deal with this little annoyance in other products by having a
retry counter loop.  So many consecutive recv()s of 0 length constitues a
closed connection.  Something like this might work here as well?

> Pete
>
> P.S.  I use this standard: http://www.unix.org/unix03.html .  Is this 
> incorrect?

Brians' link is to the Single Unix Spec V2, so it's not all that old.

> Peter A. Stephens
> ptfoof AT sbcglobal DOT net
>
> -----Original Message-----
> From: Brian Ford [mailto:ford AT vss DOT fsi DOT com]
> Sent: Monday, March 28, 2005 11:37 AM
> To: Peter Stephens
> Cc: cygwin AT cygwin DOT com
> Subject: RE: recv and errno during a connection reset/closed by peer
>
> On Fri, 25 Mar 2005, Peter Stephens wrote:
>
>> I boiled this down to nothing(see below).  I must be missing 
>> something basic.
>
> Yup.
>
>> I tried the suggestions made so far and it never gets to:
>>
>> 	printf(" >>> ERRNO %i\n", errno);
>>
>> I would expect that on a disconnect (I use putty in telnet or raw
>> mode) it would return -1 whether it is doing MSG_PEEK or an actual 
>> retrieval.  No luck.
>
> Nope (http://www.opengroup.org/onlinepubs/7990989775/xns/recv.html):
>
> "If no messages are available to be received and the peer has 
> performed an orderly shutdown, recv() returns 0."
>
> I think that's what you're missing.
>
> --
> 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/
>

--
Peter A. Castro <doctor AT fruitbat DOT org> or <Peter DOT Castro AT oracle DOT com>
 	"Cats are just autistic Dogs" -- Dr. Tony Attwood

------=_NextPart_000_0000_01C533F1.A20022E0
Content-Type: text/x-vcard;
	name="Peter Stephens.vcf"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="Peter Stephens.vcf"

BEGIN:VCARD
VERSION:2.1
N:Stephens;Peter
FN:Peter Stephens
ORG:Home
TITLE:Engineer
TEL;WORK;VOICE:(765) 451-7074
TEL;HOME;VOICE:(765) 452-5757
ADR;WORK:;;712 West Sycamore;;;46901
LABEL;WORK;ENCODING=3DQUOTED-PRINTABLE:712 West Sycamore=3D0D=3D0A46901
ADR;HOME:;;712 West Sycamore;Kokomo;Indiana;46901;United States of America
LABEL;HOME;ENCODING=3DQUOTED-PRINTABLE:712 West Sycamore=3D0D=3D0AKokomo, I=
ndiana 46901=3D0D=3D0AUnited States of America
KEY;X509;ENCODING=3DBASE64:
    MIICUTCCAbqgAwIBAgIDDY5MMA0GCSqGSIb3DQEBBAUAMGIxCzAJBgNVBAYTAlpBMSUwIwYD
    VQQKExxUaGF3dGUgQ29uc3VsdGluZyAoUHR5KSBMdGQuMSwwKgYDVQQDEyNUaGF3dGUgUGVy
    c29uYWwgRnJlZW1haWwgSXNzdWluZyBDQTAeFw0wNDEyMDUwMDA5MTBaFw0wNTEyMDUwMDA5
    MTBaMEYxHzAdBgNVBAMTFlRoYXd0ZSBGcmVlbWFpbCBNZW1iZXIxIzAhBgkqhkiG9w0BCQEW
    FHB0Zm9vZkBzYmNnbG9iYWwubmV0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDf2LTd
    qZziVqegERBKR+v4/4gtWglb6etefelI8Tffp6S1wEMp1gf2jxiJaFI9ftbDWXJalcHfrI2i
    7YPp6WoYR2tBjRK6mBNP/t2J0YN18g5QSZQv946WpU+JDLPYzC7Ect17sNHNaw4yYWSDoTMn
    0u2g4IWi4M5wYEPT3iKVjwIDAQABozEwLzAfBgNVHREEGDAWgRRwdGZvb2ZAc2JjZ2xvYmFs
    Lm5ldDAMBgNVHRMBAf8EAjAAMA0GCSqGSIb3DQEBBAUAA4GBAAQa2uZI/EzMOZL5+SKm8UGd
    32o+AQKEoFv1CGKOeKEum1cUgTExIGWdy3uKzoS32/S+1TiGPxDd0Eis/BoYxfyHWP7eFmJA
    M3fV1o5RSLKUEBx8NjFqXZPXIsU9rBawh4jAyBD5Z6aJhdNPhljk+dV2IEyFmziHJ2AzI/bK
    qVEk

EMAIL;PREF;INTERNET:ptfoof AT sbcglobal DOT net
REV:20041211T220759Z
END:VCARD


------=_NextPart_000_0000_01C533F1.A20022E0
Content-Type: text/plain; charset=us-ascii

--
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/
------=_NextPart_000_0000_01C533F1.A20022E0--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019