training
This commit is contained in:
37
tester_1.sh
Normal file
37
tester_1.sh
Normal file
@@ -0,0 +1,37 @@
|
||||
#!/bin/bash
|
||||
|
||||
port=0
|
||||
while [ "$port" -lt 1024 -o "$port" -gt 10000 ]
|
||||
do
|
||||
port=$RANDOM
|
||||
done
|
||||
id=0
|
||||
|
||||
launch() {
|
||||
while read -r line
|
||||
do
|
||||
echo "receiver $id: $line"
|
||||
done < <(nc 127.0.0.1 "$port" 2>&1) &
|
||||
((++id))
|
||||
}
|
||||
|
||||
clang -Wall -Wextra -Werror mini_serv.c
|
||||
./a.out "$port" 2>&1 &
|
||||
launch
|
||||
|
||||
#launch
|
||||
#launch
|
||||
#launch
|
||||
#kill -KILL $(pidof nc | tr ' ' '\n' | head -n1 )
|
||||
#launch
|
||||
#kill -KILL $(pidof nc | tr ' ' '\n' | head -n1 )
|
||||
#launch
|
||||
#kill -KILL $(pidof nc | tr ' ' '\n' | head -n1 )
|
||||
|
||||
for i in {1..30}
|
||||
do
|
||||
launch
|
||||
kill -KILL $(pidof nc | tr ' ' '\n' | head -n1 )
|
||||
done
|
||||
|
||||
killall -q a.out nc
|
||||
Reference in New Issue
Block a user