toeplitz_client.sh (667B)
1#!/bin/bash 2# SPDX-License-Identifier: GPL-2.0 3# 4# A simple program for generating traffic for the toeplitz test. 5# 6# This program sends packets periodically for, conservatively, 20 seconds. The 7# intent is for the calling program to kill this program once it is no longer 8# needed, rather than waiting for the 20 second expiration. 9 10send_traffic() { 11 expiration=$((SECONDS+20)) 12 while [[ "${SECONDS}" -lt "${expiration}" ]] 13 do 14 if [[ "${PROTO}" == "-u" ]]; then 15 echo "msg $i" | nc "${IPVER}" -u -w 0 "${ADDR}" "${PORT}" 16 else 17 echo "msg $i" | nc "${IPVER}" -w 0 "${ADDR}" "${PORT}" 18 fi 19 sleep 0.001 20 done 21} 22 23PROTO=$1 24IPVER=$2 25ADDR=$3 26PORT=$4 27 28send_traffic