avinash chaurasia wrote:
> 
> 
> hi all,
> Does tcp packet in wireless have data in payload as whenever i tried to
> print it using
> if((PacketData*)p->userdata()!
> =NULL) {
>             PacketData* packdata = (PacketData*)p->userdata();
>             unsigned char* pdata = (unsigned char*)packdata->data();
>             printf("data =  %s and p data = %d ",pdata, pdata);
> }
> 
> it shows some awkward result(unreadable format) with %s and blank with %c
> but have some random numbers with %d, while datalen() returns 10 but
> strlen(pdata) returns 1 .  Can i think number returned by %d is real
> payload? if no please let me know how to write payload on trace files.
> 
> 
> Thanks
> Avinash Kumar Chaurasia
> Department of Computer Science
> IIT Kanpur, India
> 
> 

userdata() is a Packet class method. 
It's not a TCP feature in ns2.

Which TCL file did you run in your test ?

Do you have to use TCP at the transport layer ? 
There is MessagePassingAgent class in messpass.h and messpass.cc in the
common directory. 
Look at tcl/ex/wireless-flooding.tcl for a nice example to carry ascii text
in a simulation.


-- 
View this message in context: 
http://old.nabble.com/data-payload-in-packet-tp29205750p29239184.html
Sent from the ns-users mailing list archive at Nabble.com.

Reply via email to