#!/bin/bash
# $1 server/client option.
# $n netperf args

#usage: netperf {server|client} opp_ip_addr [options]
#where:
#	server	- Specifies this instances is running as the server.
#	client	- Specifies this instances is running as the client.
#	opp_ip_addr	- ip address of the other end. (ie, of the server if
#			  this is running as the client and viceversa.)
# options:
#	no options yet defined.

. /etc/autobench.conf || . functions

case $1 in 
	server)
		netserver -p 12865
		;;
 	client)
        	if [ $# -gt 1 ]; then
			opts="-H $2"
	        fi
		/usr/bin/netperf $opts \
			| tee $LOGDIR/benchmark/netperfout.$RUN_NUMBER
		;;
	*)
		echo "usage: netperf (server|client) [options]"
		exit 1;
		;;
esac
