Perl programming on mMPE/iX - August 2001

HP World Page 30August 21, 2001
sockets - an object-oriented client example
#!/PERL/PUB/perl -w
use IO::Socket;
# create the socket and connect to the host
$remote = IO::Socket::INET->new(
Proto = 'tcp',
PeerAddr = 'localhost',
PeerPort = 'daytime');
$timestamp = <$remote>; # read a line of data from the socket
print "$timestamp\n"; # print the results
close($remote); # close the socket