Hi, I am trying to access the contents of the data payload of a packet in NS2 i.e. the actual bits of data. I have something like this:
from packet.h, I can see that it has functions 'accessdata' and 'userdata' both of which return the data payload one way or another. But when I do this: if((PacketData*)p->userdata()!=NULL) { PacketData* packdata = (PacketData*)p->userdata(); char* pdata = (char*)packdata->data(); printf("data = %c\n", pdata); } if (p->accessdata()!=NULL){ data_char = p->accessdata(); printf("data = %c and p->datalength = %d real length = %d \n", data_char, p->datalen(), ((PacketData*)(p->userdata()))->size() ); } I get the correct lengths of the packet, but data is empty...prints just empty space. Can anyone help me access the contents of the data payload in NS2? I need to compare the contents of two packets. Any other ideas. Thanks PS: in one documentation for NS2, I read something which seems to suggest that the payload of packets in NS2 does not contain anything because its only a simulated packet. Any ideas?