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: Fri, 22 Nov 2002 01:11:35 -0500 (EST) From: Wayne Clerke To: cygwin AT cygwin DOT com Subject: bug in cygwin select/socket code(?) Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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) . Here's the output using v1.3.15: $ perl -w testSockets.pl sock created: Operation now in progress Exception (Connection refused) Writable (Connection refused) Exception (Connection refused) Exception (Connection refused) Exception (Connection refused) Exception (Connection refused) Exception (Connection refused) etc.. Here's the code I used: use IO::Socket; use IO::Select; use strict; use warnings; my $sock = IO::Socket::INET->new(Proto=>'tcp') or warn $!; $sock->blocking(0) or warn $!; my $addr='127.0.0.1'; my $port=2; $addr = inet_aton($addr) or warn("inet_aton: $!"), return undef; my $sockaddr = sockaddr_in($port, $addr) or warn, return undef; $sock->connect($sockaddr); if ($sock) {print "sock created: $!\n"} else {print "Immediate refusal: $!"; exit}; my $sel = IO::Select->new($sock) or warn; while ($sel->handles) { if ($sel->has_exception(.001)) { print "Exception (", $!=$sock->sockopt(SO_ERROR), ")\n"; }; if ($sel->can_write(.001)) { print "Writable (", $!=$sock->sockopt(SO_ERROR), ")\n"; }; } clerke -- 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/