Skip to content

Instantly share code, notes, and snippets.

@olegwtf
Created December 16, 2014 10:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save olegwtf/ebfc9dcadb98eafe2216 to your computer and use it in GitHub Desktop.
Save olegwtf/ebfc9dcadb98eafe2216 to your computer and use it in GitHub Desktop.
IO::Socket::IP bug
use strict;
use IO::Socket::IP;
use Socket 'IPPROTO_TCP';
use IO::Select;
my ($err, @res) = Socket::getaddrinfo("www.google.com", 80, {protocol => IPPROTO_TCP});
die $err if $err;
my $ip = IO::Socket::IP->new(Blocking => 0, PeerAddrInfo => \@res) or die $@;
my $sel = IO::Select->new($ip);
$sel->can_write(10) or die "can't connect in 10 sec";
warn "Connected!";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment