#!/usr/bin/env bash
#
# == Checks how many connections can be linked with Keep-Alive
#

if [ "$2" = "" ]; then
	echo Usage $0 ip port
	exit 1;
fi

A=0
while : ; do  \
	printf "GET / HTTP/1.1\r\n"; \
	printf "Host: getfat\r\n"; \
	printf "Connection: Keep-Alive\r\n\r\n"; \
	let A=A+1
	echo $A  > /dev/stderr
	sleep 1
done | nc $1 $2 > /dev/null
