Perl programming on MPE/iX - April 2002

Solution Symposium Page 31April 4, 2002
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