This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: UDP socket select/recvfrom problem when no server


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@cygwin.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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]