// obtain start timestamp start = time (NULL); // transfer data send(sock, temps, strlen(temps) ,0); // obtain end timestamp end = time (NULL); end - start = transfer_time
When I run the code, it states that the start and end times are the same regardless of the file size, so I'm thinking that it executes without waiting for the send to finish - the end time is taken before the send is actually done. Does the code wait until the data is completely finished sending before executing the next line? If not, how can I ensure that the end time is taken only when the data is finished sending?