Calculating time required to recieve packets...

Discussion in 'C++' started by Adam Balgach, Sep 28, 2004.

  1. Adam Balgach

    Adam Balgach Guest

    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.
    Adam Balgach, Sep 28, 2004
    #1
    1. Advertising

  2. * 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?
    Alf P. Steinbach, Sep 28, 2004
    #2
    1. Advertising

  3. Adam Balgach

    Adam Balgach Guest

    (Alf P. Steinbach) wrote in message news:<>...
    > * Adam Balgach:
    > >

    >
    > OT



    what does that mean?
    Adam Balgach, Sep 28, 2004
    #3
  4. "Adam Balgach" <> wrote in message
    news:...
    > (Alf P. Steinbach) wrote in message
    > news:<>...
    >> * 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
    John Harrison, Sep 28, 2004
    #4
  5. >>>
    >>> 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) << " seconds\n";

    john
    John Harrison, Sep 28, 2004
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. M. Duijkers
    Replies:
    2
    Views:
    476
    Joe Smith
    Dec 12, 2004
  2. Sosh123
    Replies:
    2
    Views:
    444
    Sosh123
    Jun 1, 2005
  3. sreehari
    Replies:
    7
    Views:
    345
  4. Jayesh Kamdar
    Replies:
    2
    Views:
    156
    Gunnar Hjalmarsson
    May 25, 2005
  5. Washington Ratso
    Replies:
    1
    Views:
    60
    Chris “Kwpolska†Warrick
    Apr 3, 2014
Loading...

Share This Page