C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Calculating time required to recieve packets...

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++)
View previous topic :: View next topic  
Author Message
Adam Balgach
Guest





PostPosted: Tue Sep 28, 2004 3:48 pm    Post subject: Calculating time required to recieve packets... Reply with quote



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





PostPosted: Tue Sep 28, 2004 3:48 pm    Post subject: Re: Calculating time required to recieve packets... Reply with quote



* Adam Balgach:
Quote:


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





PostPosted: Tue Sep 28, 2004 9:40 pm    Post subject: Re: Calculating time required to recieve packets... Reply with quote



[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





PostPosted: Tue Sep 28, 2004 10:06 pm    Post subject: Re: Calculating time required to recieve packets... Reply with quote


"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





PostPosted: Tue Sep 28, 2004 10:09 pm    Post subject: Re: Calculating time required to recieve packets... Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.