#!/usr/bin/perl -w use strict; use IO::Socket; use Win32::GuiTest qw(:ALL); my $host = shift || 'localhost'; my $port = shift || '9000'; my ($kidpid, $socket, $line); # create a tcp connection to the specified host and port $socket = IO::Socket::INET->new( Proto => 'tcp', PeerAddr => $host, PeerPort => $port ) or die "can't connect to port $port on $host: $!"; print "[Connected to $host:$port]\n"; while (1) { while (defined ($line = <$socket>)) { sleep(1); chomp($line); SendKeys($line); print "$line\n"; } }