#!/usr/bin/perl -w use IO::Socket; use strict; if($ARGV[0] and $ARGV[1]) { my $remote_host = $ARGV[0]; my $remote_port = $ARGV[1]; my $socket = IO::Socket::INET->new(PeerAddr => $remote_host, PeerPort => $remote_port, Proto => "tcp", Type => SOCK_STREAM) or die "Couln't connect to $remote_host:$remote_port: $@\n"; print $socket "1\n"; #sleep(2); print $socket "2\n"; my $answer = <$socket>; print "Receiving: $answer\n"; close ($socket); #sleep(5); } else { print "Sorry you have to tell the client the IPadress and Portadress of the server!-> e.g: perl client.pl 194.94.217.81 9999\n"; }