Created
December 24, 2012 10:37
-
-
Save mumumu/4368762 to your computer and use it in GitHub Desktop.
this code gets "Bad arg length for Socket::pack_sockaddr_in" error. we can fix this error by changing 2nd parameter of pack_sockaddr_in function.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl -w | |
use strict; | |
use warnings; | |
use IO::Socket; | |
use Data::Dumper; | |
my $socket = IO::Socket::INET->new( | |
Proto => 'tcp', | |
Type => SOCK_STREAM | |
) || die "creating socket: $!"; | |
my $port = 80; | |
my $remote_addr = "www.google.com"; | |
$remote_addr = pack_sockaddr_in( $port, $remote_addr ); | |
connect($socket, $remote_addr); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment