Skip to content

Instantly share code, notes, and snippets.

@HoffmannP
Last active May 5, 2017 12:06
Show Gist options
  • Save HoffmannP/3ad3850f5d8d3906408b91fcdc8e95b5 to your computer and use it in GitHub Desktop.
Save HoffmannP/3ad3850f5d8d3906408b91fcdc8e95b5 to your computer and use it in GitHub Desktop.
Scripte um zu untersuchen ob die Übertragungsrate nach einem Ping systematisch höher ist
### SERVER.sh
PORT=9876
DATA=/tmp/rand.data
SIZE=1M
while true
do
netcat -l $PORT < "$DATA"
dd if=/dev/urandom of="$DATA" bs=$SIZE count=1
done
### CLIENT.sh
SERVER="server"
PORT=9876
UNIT_WAIT="m"
MIN_WAIT=30
MAX_WAIT=240
LOGFILE=$HOME/.logDieselPing
(while true
do
echo -n "Vorher: "
time netcat $SERVER $PORT >/dev/null
ping -c 1 $SERVER | tail -1
sleep 2s
echo -n "Nachher: "
time netcat $SERVER $PORT >/dev/null
WAIT=$[(MAX_WAIT - MIN_WAIT) * $RANDOM / 32767 + $MIN_WAIT]
sleep ${WAIT}${UNIT_WAIT}
done) > $LOGFILE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment