Reputation: 849
I wrote a bash script to run both client and server.
The code is written in cpp and client and server are executable.
$port=8008
$pack_rate=16
echo "Starting server"
./server -p $port -n 512 -e 0.001
echo "Starting client"
./client -p $port -n 512 -l 16 -s localhost -r $pack_rate -d
echo "end"
In the above case, the client will send data packets to the server and the server will process it.
So, both the client and server should run at the same time.
I tried to run the script file, but as expected only
"Starting server"
is getting printed. So, server is running and server will not terminate until it receives 512 packets from the client. But client process can not start until server ends in the bash script.
So, is there any way by which I can run both the process simultaneously using single bash script?
Upvotes: 0
Views: 199
Reputation: 6130
add &
add the end of the ./server
line, it will run the process in batch mode, and keep executing the rest of the script
Upvotes: 1
Reputation: 1114
You need to add an &:
./server -p $port -n 512 -e 0.001 &
Thus, the script will not wait the end of the server program to continue.
Upvotes: 1