| View previous topic :: View next topic |
| Author |
Message |
Adam Balgach Guest
|
Posted: Tue Sep 28, 2004 3:48 pm Post subject: Calculating time required to recieve packets... |
|
|
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.
|
|
| Back to top |
|
 |
Alf P. Steinbach Guest
|
Posted: Tue Sep 28, 2004 3:48 pm Post subject: Re: Calculating time required to recieve packets... |
|
|
* Adam Balgach:
OT
--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
|
|
| Back to top |
|
 |
Adam Balgach Guest
|
Posted: Tue Sep 28, 2004 9:40 pm Post subject: Re: Calculating time required to recieve packets... |
|
|
[email]alfps (AT) start (DOT) no[/email] (Alf P. Steinbach) wrote in message news:<415987bb.50991125 (AT) news (DOT) individual.net>...
| Quote: | * Adam Balgach:
OT
|
what does that mean?
|
|
| Back to top |
|
 |
John Harrison Guest
|
Posted: Tue Sep 28, 2004 10:06 pm Post subject: Re: Calculating time required to recieve packets... |
|
|
"Adam Balgach" <ffld (AT) hotmail (DOT) com> wrote
| Quote: | alfps (AT) start (DOT) no (Alf P. Steinbach) wrote in message
news:<415987bb.50991125 (AT) news (DOT) individual.net>...
* Adam Balgach:
OT
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
|
|
| Back to top |
|
 |
John Harrison Guest
|
Posted: Tue Sep 28, 2004 10:09 pm Post subject: Re: Calculating time required to recieve packets... |
|
|
| Quote: |
OT
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.
|
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) << " secondsn";
john
|
|
| Back to top |
|
 |
|