[ndnSIM] How to add a new variable

呂建德 v0918732669 at gmail.com
Fri Feb 10 21:08:01 PST 2017


thanks! Alex!

 I got it

2017-02-11 12:37 GMT+08:00 Alex Afanasyev <aa at cs.ucla.edu>:

>
> On Feb 10, 2017, at 7:30 PM, 呂建德 <v0918732669 at gmail.com> wrote:
>
> I test the same code on three platfoms like below.
>
> http://imgur.com/a/9e38l
>
> and the first one is mac os, second one is mint based on ubuntu16.04, the
> last one is ubuntu16.04 LTS.
>
> the code in ndn-producer is
> data->setContent(::ndn::encoding::makeStringBlock(::ndn::tlv::Content,
> str));
>
> the code in ndn-consumer is
> NS_LOG_INFO("< DATA for " << data->getContent().value());
>
>
>
> This is not the proper way of interpreting content as a string.  This will
> try to interpret bytes carried in the content as a null-terminated string,
> which the content probably isn't.
>
> Use this, a bit more explicit, way:
>
> std::string stringValue(data->getContent().value(),
> data->getContent().value_size());
>
>
>
> I dont know what happened on these platforms, the same code ,the different
> result. orz
>
>>
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20170211/9cac9860/attachment.html>


More information about the ndnSIM mailing list