#!/usr/local/bin/perl5 -w use IO::Socket; #******************************************* # daytime-client.pl - daytime service client #****************************************** $port = 8000; $host = "euro.ecom"; # # request a TCP connection to the daytime service # listening on port $port on host $host # # Proto : request a TCP connection # PeerAddr : to server running on $host # PeerPort : and listening to port $port $sockfd = IO::Socket::INET->new(Proto => "tcp", PeerAddr => $host, PeerPort => $port) or die "Couldn't connect to port $port on $host: $@\n"; # # wait for the response from the server # and print it to stdout # $time = <$sockfd>; print $time; # close socket close $sockfd;