[ndnSIM] How to add string data on packet

Yoshimichi Nakatsuka nakatsuka at west.sd.keio.ac.jp
Wed Dec 14 01:03:04 PST 2016


Hi JianDe,

Here's how I added a string data to a Data packet for a Content producer 
to send:

#include "../ndn-cxx/src/encoding/block-helpers.hpp"
#include "../ndn-cxx/src/encoding/tlv.hpp"
auto data = make_shared<Data>();
const std::string str = "01010101";
data->setContent(::ndn::encoding::makeStringBlock(::ndn::tlv::Content, 
str));


The way for a Consumer to check the data it received is:

data->getContent().value();


I hope this helps!!

Best regards,
Yoshimichi Nakatsuka

On 2016/12/14 15:41, 呂建德 wrote:
> Dear all ndn-sim user
>
>
> I want to add some data  like "01010101" on data packet
>
> And then , for consumer , have to check the data "01010101" right or not.
>
> there will be a channel coding on it.
>
> so I dont know how to add to the packet.
>
> I know the ns2 how to add , but the ns3 ndn-sim i cant.
>
> can someone help me?
>
> Best wishes,  JianDe
>
>
> _______________________________________________
> ndnSIM mailing list
> ndnSIM at lists.cs.ucla.edu
> http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20161214/b57ebe28/attachment.html>


More information about the ndnSIM mailing list