[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ns] Problem when while loop is present in Agent



Hi,
     In NS i added my own agent. One additional functionality was added
to the agent. It will read data from a file and prepare one packet of
data for one line and send it to the receiver. This will be done until
the EOF is reached.   The code for this is something like this:

void  SRTPAgent::start(File *fptr)
{
        running_=1;
        unsigned char data[size_];
        while (fgets((char*) data,size,fptr) != NULL)
        {
                  int size = strlen((char*)data)+1;
                  send(size,data);
                  srtp_timer_.resched(interval_);
         }
         running_ = 0;
   }

Now when this particular functionality is called, the trace file shows
that the packet is being enqueued till the EOF is reached and then
dequeued one by one and sent only after the while loop is exited. Is
there any facility in NS where in the packet can be dequeued and sent,
parallely along with enqueueing  within the while loop itself.


Regards,
Amarnath H.S.