develooper Front page | perl.perl5.porters | Postings from December 2004

[perl #33619] IO::Socket::INET.pm bug fix

Thread Previous | Thread Next
From:
Chris Drake
Date:
December 31, 2004 02:06
Subject:
[perl #33619] IO::Socket::INET.pm bug fix
Message ID:
rt-3.0.11-33619-104814.12.4116838261686@perl.org
# New Ticket Created by  Chris Drake 
# Please include the string:  [perl #33619]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org:80/rt3/Ticket/Display.html?id=33619 >


IO::Socket::INET.pm module cannot do nonblocking connects. ActiveState fixed the
Win32 version a year or so ago.  Here's the test script and comments:-
http://aspn.activestate.com/ASPN/Mail/Message/perl5-porters/2030994


Here's a corresponding Unix fix (Tested OK on RedHat EL3.0):-


*** /usr/lib/perl5/5.8.0/IO/Socket/INET.pm.ori  2004-06-28 18:40:57.000000000 +0000
--- INET.pm     2004-12-30 16:33:23.000000000 +0000
***************
*** 193,196 ****
--- 193,208 ----
  #        my $before = time() if $timeout;
  
+ 
+         # these 8 lines contributed by Chris Drake:-
+         if(defined $arg->{Blocking}) {
+           if($arg->{Blocking}) {
+             $sock->blocking($arg->{Blocking})
+           } else {
+             $sock->blocking(undef);
+             my $temp = 1; ioctl($sock, 0x8004667E, \$temp); # Don't let it block us.
+           }
+         }
+ 
+ 
        undef $@;
          if ($sock->connect(pack_sockaddr_in($rport, $raddr))) {

          
Kind Regards,
Chris Drake


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About