[ndnSIM] How to get the payload of the Data packet as what it originally is

Spyridon (Spyros) Mastorakis mastorakis at cs.ucla.edu
Thu Sep 13 19:29:27 PDT 2018


Hi,

this is related to properly encoding/decoding the payload of your data packets.

There are a few examples of encoding/decoding you can refer to:

https://github.com/spirosmastorakis/nTorrent/blob/master/src/torrent-file.cpp#L97 <https://github.com/spirosmastorakis/nTorrent/blob/master/src/torrent-file.cpp#L97>
https://github.com/spirosmastorakis/nTorrent/blob/master/src/torrent-file.cpp#L158 <https://github.com/spirosmastorakis/nTorrent/blob/master/src/torrent-file.cpp#L158>
https://github.com/spirosmastorakis/nTorrent/blob/master/src/file-manifest.cpp#L147 <https://github.com/spirosmastorakis/nTorrent/blob/master/src/file-manifest.cpp#L147>
https://github.com/spirosmastorakis/nTorrent/blob/master/src/file-manifest.cpp#L253 <https://github.com/spirosmastorakis/nTorrent/blob/master/src/file-manifest.cpp#L253>

Thanks,

Spyridon (Spyros) Mastorakis
Personal Website: http://cs.ucla.edu/~mastorakis/ <http://cs.ucla.edu/~mastorakis/>
Internet Research Laboratory
Computer Science Department
UCLA

> On Sep 13, 2018, at 2:15 AM, mengxue <mengxue_1224 at 126.com> wrote:
> 
> Hi,all
>    I am new in ndnSIM and met with some problems recently.
>    Assume that I defined a class " Student " and want to attach an instantiation named " newStudent " of  the "Student" class as the payload of a Data packet.
>    I wonder what should I do to set this instantiation as the payload of the Data packet so that  in other nodes  I can get the payload just as what it originally is,i.e.,"newStudent" , so that I can do some operations on the "newStudent".
> I have tried on the API documentation but not found the solutions using "Data::setpayload()" and "Data::getpayload()".
>   Thank you very much!
>   Best regards,
>   Xin Zhang

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20180913/d4613928/attachment.html>


More information about the ndnSIM mailing list