#!/usr/bin/perl -w
use strict;
use Socket;
# Host, port and protocol etc
my $host = shift || 'localhost';
my $port = shift || 80;
my $file = shift || '/';
my $count = 0;
my $times = shift || 400;
my $proto = getprotobyname('tcp');
my $EOL = "\015\012";
my $BLANK = $EOL x 2;
my $iaddr = inet_aton($host);
my $paddr = sockaddr_in($port, $iaddr);
#Create the socket, connect
socket(SOCKET, AF_INET, SOCK_STREAM, $proto) or die "socket: $!";
connect (SOCKET, $paddr) or die "connect: $!";
print "GET $file HTTP/1.1" . $BLANK;
<$file>;
close SOCKET or die "close: $!";