#!/usr/bin/perl -w | |
use IO::Socket ; | |
use IO::Handle ; | |
my $host = $ARGV[0] || "localhost"; | |
my $port = $ARGV[1] || 8000; | |
STDERR->autoflush(1); | |
STDOUT->autoflush(1); | |
my $data = ""; | |
my $sock = new IO::Socket::INET( | |
PeerAddr => $host, | |
PeerPort => $port, | |
Proto => 'tcp', | |
Timeout => 30) ; | |
if (! $sock) { die "ERROR! Can't connect\n" ;} | |
$sock->autoflush(1); | |
print $sock "\x55\x55\xaa\xaa\x00\x00\x00\x00\x00\x00\x00\x50"; | |
if( ! read($sock, $data, 16) ) { die "Error"; } | |
while(read($sock, $data, 2048)) | |
{ | |
print $data; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment