mirror of https://github.com/tongzx/nt5src
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
590 B
29 lines
590 B
use Socket;
|
|
|
|
@ARGV || die "Server name required!\n";
|
|
|
|
$remote = $ARGV[0];
|
|
print "Connecting to $remote...\n";
|
|
|
|
$iaddr = inet_aton($remote) || die "no host: $remote";
|
|
$paddr = sockaddr_in(80, $iaddr);
|
|
socket(SOCK, PF_INET, SOCK_STREAM, getprotobyname('tcp')) || die "socket: $!";
|
|
connect(SOCK, $paddr);
|
|
print "Connected\n";
|
|
|
|
select((select(SOCK), $| = 1)[0]);
|
|
|
|
while( defined( $line = <STDIN> ) )
|
|
{
|
|
chop $line;
|
|
$line = $line . "\015\012";
|
|
print SOCK $line;
|
|
}
|
|
|
|
print "Waiting for response\n";
|
|
while( 1 )
|
|
{
|
|
$var = 1;
|
|
read( SOCK, $var, 1);
|
|
print $var;
|
|
}
|