Reputation: 49
I have a file transfer program using TCP sockets (server.c and client.c). Server.c can accept multiple client connections using threads. Client.c connects to the server and waits for user input 'get' to receive a list of downloadable files in the server directory. The client then waits for user input to select one or more files that they want to download (Ex1. $ test.txt) (Ex2. $ test.txt sample.txt). The server then sends that file(s) to the client if it exists. The time to transfer is logged.
Now, I want to test the time to transfer by:
I assume that I have to create a script (shell script?) to do this. However, how would I create this script if my client.c takes user input ('get' files request and input files)? Does this even matter or do I need to modify my program? I haven't written scripts yet so this is all new to me.
Upvotes: 0
Views: 56
Reputation: 43280
A bit of bash glue:
date
for x in 1 2 3 4 5 6 7 8 9 10
do
echo "get file" | ./client &
done
wait
date
Key points: &
to run the download in the background, and wait
to collect all the background jobs.
Once having the idea you should be able to come up with a better one.
Upvotes: 1