delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/03/29/20:28:56

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
Date: Tue, 29 Mar 2005 17:27:12 -0800 (PST)
From: "Peter A. Castro" <doctor AT fruitbat DOT org>
To: Peter Stephens <ptfoof AT sbcglobal DOT net>
cc: cygwin AT cygwin DOT com
Subject: RE: recv and errno during a connection reset/closed by peer
In-Reply-To: <!~!UENERkVCMDkAAQACAAAAAAAAAAAAAAAAABgAAAAAAAAAUKQItienSEKG+9226yKd5cKAAAAQAAAAdWX/pT74GUisDog/o7TE3gEAAAAA@sbcglobal.net>
Message-ID: <Pine.LNX.4.60.0503291723220.736@gremlin.fruitbat.org>
References: <!~!UENERkVCMDkAAQACAAAAAAAAAAAAAAAAABgAAAAAAAAAUKQItienSEKG+9226yKd5cKAAAAQAAAAdWX/pT74GUisDog/o7TE3gEAAAAA AT sbcglobal DOT net>
MIME-Version: 1.0
X-IsSubscribed: yes

On Tue, 29 Mar 2005, Peter Stephens wrote:

> Peter,

Hi Peter :)

> I have thought about your suggestion and it makes a lot of sense.  If I
> understand correctly this is what you are thinking about:

Yes, this is pretty similar to how I've solve this before.  It's a good
compromise for an (arguably) imperfect interface.

>   int I = 0;
> << another new line
>   do{
>     ret_val = recv(afd, buf, MAX_BUF, MSG_PEEK);
>     if(0 > ret_val)
>       err(" >>> ERRNO");
>     else if(0 == ret_val){						<<
> new lines start here
>       if(100 < i++)
>          done = -1;
>     }
> << new lines end here
>     else if(ret_val > 0){
>       i = 0;
> << another new line
>       show_status(afd);
>       ret_val = recv(afd, buf, MAX_BUF, 0);
>       buf[ret_val]='\0';
>       printf("(%i) \t> %s", ret_val, buf);
>     }
>     usleep(250);
>     if(!done)
> << another new line
>        done = handle_it(buf);
>   }while(!done);
>
> It seems like your suggestion would be very portable.  A good suggestion and
> the most likely route for me at this point.

I hope it does the job for you.

> Peter A. Stephens
> ptfoof AT sbcglobal DOT net

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

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

- Raw text -


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