Calculating time required to recieve packets...

A

Adam Balgach

Greets all,

i am in the process of writing a simple client/server file upload
program that sends data via UDP packets. I have the process of
opening.sending, recieving & writing all working (via a stop/wait arq)
now what i would ideally like to do is time how long hte transfer took
place, ie from the moment that the first packet was recieved until the
last, so that i can calculted the transfer rate. (also i would liek
to implement a timeout/resend if packets get lost) but i dont even
know wehre to begin. ive been looking at struct timeval but can find
any resonable examples for this. anyone have any idea?

thanks.

Cheers,
Adam.
 
J

John Harrison

Adam Balgach said:
(e-mail address removed) (Alf P. Steinbach) wrote in message



what does that mean?

Off Topic. Your question is not a topic that is discussed on this group.
Here we discuss the C++ language, not network programming. Have a look at
this groups welcome message http://www.slack.net/~shiva/welcome.txt which
has suggestions for other groups that might be more suitable for your
question.

john
 
J

John Harrison

Off Topic. Your question is not a topic that is discussed on this group.
Here we discuss the C++ language, not network programming. Have a look at
this groups welcome message http://www.slack.net/~shiva/welcome.txt which
has suggestions for other groups that might be more suitable for your
question.

OK reading your post again I see that your question actually has nothing to
do with networking. It was the subject line that through me (and Alf as well
I guess).

Here is one way to measure elapsed time in C++

#include <time.h>

time_t t0 = time(0);

// some lengthy operation
....

time_t t1 = time(0);
cout << "That took " << difftime(t1, t0) << " seconds\n";

john
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top