#!/usr/bin/perl -w
# client1.pl - a simple client
#----------------

use strict;
use Socket;

# initialize host and port
my $proto = getprotobyname('tcp');

# get the port address
my $iaddr = inet_aton($ARGV[0]);
my $paddr = sockaddr_in($ARGV[1], $iaddr);

#open FIC,">> journal.txt";

# create the socket, connect to the port
while ( 1 )
    {
    open FIC,">> journal.txt";
    my $t = localtime( );
    print FIC "$t\n";
    socket(SOCKET, PF_INET, SOCK_STREAM, $proto) or die "socket: $!";
    connect(SOCKET, $paddr) or print FIC "connect: $!\n";
    print FIC  "-------------------------------------\n";
    sleep(1);
    close SOCKET or die "close: $!";
    sleep(4);
    }