#!/usr/bin/perl -w # client2way.pl - a client that writes to # and reads from a server use strict; use IO::Socket; my $host = shift || 'server.onsight.com'; my $port = shift || 7890; my $sock = new IO::Socket::INET( PeerAddr => $host, PeerPort => $port, Proto => 'tcp'); $sock or die "no socket :$!"; # send message to server print $sock "HELLO\n"; # print server response to STDOUT print scalar <$sock>; # send and print more stuff print $sock "NAME\n"; print scalar <$sock>; print $sock "DATE\n"; print scalar <$sock>; print $sock "NONE\n"; print scalar <$sock>; close $sock;