2010-09-26 21:56:51 -06:00
|
|
|
#! /bin/sh
|
|
|
|
|
|
|
|
port=8888
|
2010-10-22 11:15:37 -06:00
|
|
|
host=10.0.0.10
|
2010-09-26 21:56:51 -06:00
|
|
|
|
|
|
|
blooper=$(tempfile)
|
|
|
|
trap "rm $blooper" 0
|
|
|
|
|
2010-10-22 11:15:37 -06:00
|
|
|
echo foo | socat -t 0.01 STDIO UDP:$host:$port | tail -n +4 > $blooper
|
2010-09-26 21:56:51 -06:00
|
|
|
|
|
|
|
for i in $(seq 8); do
|
2010-10-22 11:15:37 -06:00
|
|
|
result=$(socat -t 0.01 STDIO UDP:$host:$port < $blooper | awk -F': ' '(NF > 1) {print $2; exit;}')
|
2010-09-26 21:56:51 -06:00
|
|
|
port=$(echo "ibase=8; $result" | bc)
|
|
|
|
echo $port
|
|
|
|
done
|
|
|
|
echo $result
|