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 Date: Mon, 5 Apr 2004 10:15:43 +0200 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: UDP socket select/recvfrom problem when no server Message-ID: <20040405081543.GC26575@cygbert.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2i On Apr 4 10:38, Christopher J. White wrote: > I've got a UDP socket application that fails since my > most recent upgrade, I believe from 1.5.9 to 1.5.9-1. There is only a 1.5.9-1 version. From what version did you update? AFAICS, there was no relevant change in socket code since 1.5.7. > Basic UDP app that fails as follows: > > First problem (note, 10.1.1.19 is the local machine): > > - bind 10.1.1.19:5001 > - select() -- no socket ready > - sendto 10.1.1.19:5000 > - select() -- socket ready > - recvfrom() -- error, errno = ECONNRESET > > There is no listener on 5000, so the select() should not be signaling > that it is ready...I suspect that's why the recvfrom() fails. Quoting SUSv3: "A descriptor shall be considered ready for reading when a call to an input function with O_NONBLOCK clear would not block, whether or not the function would transfer data successfully. (The function might return data, an end-of-file indication, or an error other than one indicating that it is blocked, and in each of these cases the descriptor shall be considered ready for reading.)" > Intersting twists: > 1) sento 10.1.1.42, another machine on the local subnet fails > identically when there is no app listening on port 5000 > > 1) sendto 10.1.1.xx where xx is a non-existant machine, then > the select() does not return ready, and thus I never get > to the recvfrom() > > If I start the server app on port 5000 at the destination > of sendto (either locally or not) then it runs fine. It > works even if no data is transmitted. Did you try the same on a Linux box? Does it behave differently? Can you provide a brief testcase which compiles OOTB to demonstrate the problem? > I suspect that the destination is returning an ICMP error when the > server is not running and that is what's giving select() something to > look at. However, it's my understanding that unless I do a connect(), > ICMP errors are not propogated to the app. In addition, errno should > be ECONNREFUSED in this case, and not ECONNRESET. ECONNRESET is correct according to SUSv3. Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Developer mailto:cygwin AT cygwin DOT com Red Hat, Inc. -- 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/