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
From: "Peter Stephens" <ptfoof@sbcglobal.net>
To: "'Peter A. Castro'" <doctor@fruitbat.org>
Cc: <cygwin@cygwin.com>
Subject: RE: recv and errno during a connection reset/closed by peer
Date: Tue, 29 Mar 2005 00:15:06 -0500
Message-ID: <!~!UENERkVCMDkAAQACAAAAAAAAAAAAAAAAABgAAAAAAAAAUKQItienSEKG+9226yKd5cKAAAAQAAAAdWX/pT74GUisDog/o7TE3gEAAAAA@sbcglobal.net>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
In-Reply-To: <Pine.LNX.4.60.0503281549130.736@gremlin.fruitbat.org>

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:

   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.

Peter A. Stephens
ptfoof@sbcglobal.net



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

