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

[ns] how to set the data in a packet?



Hi, there,

IS there anyone knows how to set the data in a packet? 

In my simulation, I need set some data in a packet and then send the packet out. I derived my own agent from Agent class to take care of this. Before sending the 
packet, the agent has to put some data in the packet. I used the following code to create a packet and allocate the size for its data:

Packet * pk = allocpkt();
pk->allocdata(size); //size of the data that I want to send

but I didn't find the function to set the data in the packet. from the packet.h, I know that I can use pk->setdata(Appdata *d) to pass an pointer to an instance of Class Appdata. but in the creation of the instance, there is no function that I can call to set the actual data. 

does anyone have any ideas? Any information or hints will be greatly appreciated.

Thank you.

Li yang