| | |
| | | function server() { |
| | | |
| | | # 开启bus |
| | | ./test_net_mod_socket --fun="start_bus_server" & server_pid=$! && echo "pid: ${server_pid}" |
| | | ./shm_util 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}" |
| | | ./shm_util 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}" |
| | | ./test_net_mod_socket --fun="start_reply" --key=101 & server_pid=$! && echo "pid: ${server_pid}" |
| | | ./test_net_mod_socket --fun="start_reply" --key=102 & server_pid=$! && echo "pid: ${server_pid}" |
| | | ./shm_util start_reply --key=100 & server_pid=$! && echo "pid: ${server_pid}" |
| | | ./shm_util start_reply --key=101 & server_pid=$! && echo "pid: ${server_pid}" |
| | | ./shm_util start_reply --key=102 & server_pid=$! && echo "pid: ${server_pid}" |
| | | |
| | | # 打开回队列收进程 |
| | | ./test_net_mod_socket --fun="start_resycle" & server_pid=$! && echo "pid: ${server_pid}" |
| | | ./shm_util start_resycle & server_pid=$! && echo "pid: ${server_pid}" |
| | | } |
| | | |
| | | # 交互式客户端 |
| | | function client() { |
| | | |
| | | # ./test_net_mod_socket --fun="start_net_client" \ |
| | | # ./shm_util 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" \ |
| | | ./shm_util start_net_client \ |
| | | --sendlist=" :5000:100" \ |
| | | --publist="localhost:5000" |
| | | |
| | |
| | | |
| | | # one_to_many send |
| | | function one_to_many() { |
| | | ./test_net_mod_socket --fun="one_sendto_many" \ |
| | | ./shm_util one_sendto_many \ |
| | | --sendlist=" :5000:100, :5000:101, :5000:102" |
| | | |
| | | } |
| | | |
| | | # |
| | | function send() { |
| | | ./test_net_mod_socket --fun="test_net_sendandrecv" \ |
| | | ./shm_util test_net_sendandrecv \ |
| | | --sendlist=" :5000:100, :5000:101, :5000:102" |
| | | |
| | | } |
| | | |
| | | # 无限循环 pub |
| | | function pub() { |
| | | ./test_net_mod_socket --fun="test_net_pub" \ |
| | | ./shm_util test_net_pub \ |
| | | --publist="localhost:5000, localhost:5000" |
| | | |
| | | } |
| | | # 多线程pub |
| | | function mpub() { |
| | | ./test_net_mod_socket --fun="test_net_pub_threads" \ |
| | | ./shm_util test_net_pub_threads \ |
| | | --publist="localhost:5000, localhost:5000" |
| | | |
| | | } |
| | | |
| | | function stop() { |
| | | ps -ef | grep -e "test_net_mod_socket" -e "heart_beat"| awk '{print $2}' | xargs -i kill -15 {} |
| | | ps -ef | grep -e "shm_util" -e "heart_beat"| awk '{print $2}' | xargs -i kill -15 {} |
| | | |
| | | } |
| | | |
| | | function close() { |
| | | ps -ef | grep -e "test_net_mod_socket" -e "heart_beat"| awk '{print $2}' | xargs -i kill -9 {} |
| | | ps -ef | grep -e "shm_util" -e "heart_beat"| awk '{print $2}' | xargs -i kill -9 {} |
| | | ipcrm -a |
| | | } |
| | | |