Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , 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" To: Subject: RE: recv and errno during a connection reset/closed by peer Date: Mon, 28 Mar 2005 18:17:41 -0500 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit In-Reply-To: Brian Are you saying that there is no way to distinguish a dropped connection from a MSG_PEEK with no data to retrieve? Pete P.S. I use this standard: http://www.unix.org/unix03.html . Is this incorrect? 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/