function server() {
|
|
# 开启bus
|
./test_net_mod_socket --fun="start_bus_server" & server_pid=$! && echo "pid: ${server_pid}"
|
# 开启网络转发代理
|
./test_net_mod_socket --fun="start_net_proxy" --port=5000 & server_pid=$! && echo "pid: ${server_pid}"
|
|
# 打开请求应答测试的接受端
|
./test_net_mod_socket --fun="start_reply" --key=100 & server_pid=$! && echo "pid: ${server_pid}"
|
}
|
|
# 交互式客户端
|
function client() {
|
|
# ./test_net_mod_socket --fun="start_net_client" \
|
# --sendlist="192.168.5.10:5000:11, 192.168.5.22:5000:11, 192.168.20.104:5000:11" \
|
# --publist="192.168.5.10:5000:8, 192.168.5.22:5000:8, 192.168.20.104:5000:8"
|
|
|
./test_net_mod_socket --fun="start_net_client" \
|
--sendlist="localhost:5000:100" \
|
--publist="localhost:5000"
|
|
|
}
|
|
# 无限循环send
|
function send() {
|
./test_net_mod_socket --fun="test_net_sendandrecv" \
|
--sendlist="localhost:5000:100, localhost:5000:100"
|
|
}
|
# 多线程send
|
function msend() {
|
./test_net_mod_socket --fun="test_net_sendandrecv_threads" \
|
--sendlist="localhost:5000:100, localhost:5000:100"
|
|
}
|
# 无限循环 pub
|
function pub() {
|
./test_net_mod_socket --fun="test_net_pub" \
|
--publist="localhost:5000, localhost:5000"
|
|
}
|
# 多线程pub
|
function mpub() {
|
./test_net_mod_socket --fun="test_net_pub_threads" \
|
--publist="localhost:5000, localhost:5000"
|
|
}
|
|
function close() {
|
ps -ef | grep -e "test_net_mod_socket" -e "heart_beat"| awk '{print $2}' | xargs -i kill -9 {}
|
ipcrm -a
|
}
|
|
function scp() {
|
|
scp -P 100 -rp ~/wk/softbus basic@192.168.5.22:/data/disk2/test
|
scp -rp ~/wk/softbus basic@192.168.20.10:/data3/workspace/wzq
|
}
|
|
case ${1} in
|
"server")
|
server
|
;;
|
"client")
|
client
|
;;
|
"msend")
|
msend
|
;;
|
"send")
|
send
|
;;
|
"mpub")
|
mpub
|
;;
|
"pub")
|
pub
|
;;
|
"close")
|
close
|
;;
|
"")
|
close
|
sleep 2
|
server
|
client
|
;;
|
|
*)
|
echo "argument input error"
|
exit 1
|
;;
|
esac
|