Well, what you can do is to write a function, say lengthb()) in class PacketQueue (there is a variable pq_ of class Queue). In this function, determine the number of bytes of each packet from head_ to tail_ of a PacketQueue object and returns the total number of bytes.
I posted how to determine the packet size at http://t-issariyakul.blogspot.com/2009/02/packet-size-in-ns2.html For more information about Packets, see Chapter 8 in the following book from Springer: T. Issaraiyakul and E. Hossain, "Introduction to Network Simulator NS2", Springer 2008. http://www.springer.com/engineering/signals/book/978-0-387-71759-3 You may also find the following website useful: http://www.ece.ubc.ca/~teerawat/NS2.htm Best, Teerawat hi everyone! In NS2, the length of a queue is always caculated as the number of packets in it.But we know that the size of a packet always differs from another's. In my opinion, in practice the length of a queue should be measured by the size, rather than the number, of all packets in it. In my simulation, i need to simulate the length of the Q as the total size in it,how can i achieve this? thanks in advance! Guisong Huang ´©Ô½µØÕð´ø ¼ÍÄîãë´¨µØÕðÒ»ÖÜÄê)
