summaryrefslogtreecommitdiffstats
path: root/run-client.sh
blob: 14f3b09ef4f92e6c5a647c7dd3a0f1399a17847f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#! /bin/bash

. config.sh

function run {
    $ods_path/bin/onlineDetectorSimulatorClient "$@"
}

ip=$1
mtu=1500 #max 9000
first_port=4000
num_ports=27
[ -n "$1" ] || { echo "Usage: run <ip> [first_port] [num_ports] [mtu]" ; exit 1 ; }
[ -n "$2" ] && first_port=$2
[ -n "$3" ] && num_ports=$3
[ -n "$4" ] && mtu=$4


int=$(ip route show to match "$ip" | grep src  | awk '{ print $3 }')
ip link set $int mtu $mtu

if [ $mtu -le 1500 ]; then
    sed -i '' -e 's/numberOfProjectionsPerPacket.*/numberOfProjectionsPerPacket = 40/' config.cfg
#    run "$ip" $first_port $num_ports 140000
    run "$ip" $first_port $num_ports 120000
elif [ $mtu -eq 9000 ]; then
    sed -i '' -e 's/numberOfProjectionsPerPacket.*/numberOfProjectionsPerPacket = 250/' config.cfg
    run "$ip" $first_port $num_ports 20000
fi