diff -r f23a49e8750f src/applications/onoff/onoff-application.cc --- a/src/applications/onoff/onoff-application.cc Thu Feb 05 07:57:20 2009 -0800 +++ b/src/applications/onoff/onoff-application.cc Thu Feb 05 09:11:04 2009 -0800 @@ -176,7 +176,7 @@ void OnOffApplication::StartSending() void OnOffApplication::StartSending() { NS_LOG_FUNCTION_NOARGS (); - + m_lastStartTime = Simulator::Now(); ScheduleNextTx(); // Schedule the send packet event ScheduleStopEvent(); } diff -r f23a49e8750f src/applications/onoff/onoff-application.h --- a/src/applications/onoff/onoff-application.h Thu Feb 05 07:57:20 2009 -0800 +++ b/src/applications/onoff/onoff-application.h Thu Feb 05 09:11:04 2009 -0800 @@ -64,6 +64,22 @@ class Socket; * variables. During the "Off" state, no traffic is generated. * During the "On" state, cbr traffic is generated. This cbr traffic is * characterized by the specified "data rate" and "packet size". + * + * Note: When an application is started, the first packet transmission + * occurs _after_ a delay equal to (packet size/bit rate). Note also, + * when an application transitions into an off state in between packet + * transmissions, the remaining time until when the next transmission + * would have occurred is cached and is used when the application starts + * up again. Example: packet size = 1000 bits, bit rate = 500 bits/sec. + * If the application is started at time 3 seconds, the first packet + * transmission will be scheduled for time 5 seconds (3 + 1000/500) + * and subsequent transmissions at 2 second intervals. If the above + * application were instead stopped at time 4 seconds, and restarted at + * time 5.5 seconds, then the first packet would be sent at time 6.5 seconds, + * because when it was stopped at 4 seconds, there was only 1 second remaining + * until the originally scheduled transmission, and this time remaining + * information is cached and used to schedule the next transmission + * upon restarting. */ class OnOffApplication : public Application {