This is the mail archive of the cygwin@cygwin.com 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: bug in cygwin select/socket code(?)


On Fri, Nov 22, 2002 at 01:11:35AM -0500, Wayne Clerke wrote:
> The Perl code below creates a non-blocking socket and attempts
> to connect it to 127.0.0.1:2 (which should be immediately refused),
> The loop shows the socket becomes briefly writable according to
> IO::Select. Is there some logic behind this that I'm missing?
> It was ok in cygwin v1.3.12-2, but hasn't worked as I expected
> in the last two releases (1.3.14-1, 1.3.15-2) .

It's ok as it is now.  It was incorrect before.  The connect doesn't
return immediately and FD_ISSET (fd, &writefds) returns true when the
connection is refused.  See SUSv3:

<quote http://www.opengroup.org/onlinepubs/007904975/functions/select.html>
  If a non-blocking call to the connect() function has been made for a
  socket, and the connection attempt has either succeeded or failed
  leaving a pending error, the socket shall be marked as writable.
</quote>

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
Bug reporting:         http://cygwin.com/bugs.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]