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

Re: [ns] Packet size?



On Fri, 11 May 2001, Aaron D Striegel wrote:

> Is there a simple way that I can get the packet size in C++? I need to be
> able to record the size of the packet (data only).  However, when I try to
> use the datalen() of the Packet object, I always get a zero.

	I personally use something like this, p being a pointer to your
packet (of type Packet*).

hdr_cmn* cm_h = hdr_cmn::access(p); // access the common header of p
int mySize = cm_h->size(); // in bytes

	Hope this helps,
	--Nick

------------------------------------------------------------------------
Nicolas Christin                        [email protected]
Multimedia Networks Group               http://www.cs.virginia.edu/~nc2y
------------------------------------------------------------------------