#!/usr/bin/perl -w

use strict;
use Socket;

# initialize host and port
my $host = shift || "10.1.1.1";
my $port = shift || 9999;

# create the socket, connect to the port
socket(SOCKET,PF_INET,SOCK_STREAM,(getprotobyname('tcp'))[2]) or die "Can't create a socket $!\n";
connect( SOCKET, pack_sockaddr_in($port, inet_aton($host))) or die "Can't connect to port $port! \n";

my $c;
while (defined($c = getc STDIN)) {
   print SOCKET $c;
}
close SOCKET or die "close: $!";
