#!/usr/bin/perl -w # acmemove -- a client for remotley controlling ACME #---------------- use strict; use Socket; # initialize host and port my $host = 'localhost'; my $port = 4711; my $proto = getprotobyname('tcp'); # get the port address my $iaddr = inet_aton($host); my $paddr = sockaddr_in($port, $iaddr); # create the socket, connect to the port socket(SOCKET, PF_INET, SOCK_STREAM, $proto) or die "socket: $!"; connect(SOCKET, $paddr) or die "connect: $!\nIs port $port forwarded to kiewa?\nIs the moved running on kiewa?\n"; # make sure the socket is flushed after every line my $tf = select SOCKET; $| = 1; select $tf; # send the move command for my $arg (@ARGV) { print SOCKET "$arg "; } print SOCKET "\n"; # and wait for completion my $response; while ($response = ) { print "$response"; } close SOCKET or die "close: $!";