<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; color: rgb(0, 0, 0); font-size: 14px; font-family: Calibri, sans-serif;">
<div>After</div>
<div><br>
</div>
<div>interest = Interest(name3)</div>
<div><br>
</div>
<div>try adding </div>
<div><br>
</div>
<div>interest.getExclude().appendComponent(Name("%C1.FS.file")[0])</div>
<div><br>
</div>
<div>This is because NDNFS not only serves the Data packet segments of the file, but a “meta info” packet where the name has the component “"%C1.FS.file”. The code above should exclude it.</div>
<div><br>
</div>
<div>Let us know,</div>
<div>- Jeff T</div>
<div><br>
</div>
<span id="OLK_SRC_BODY_SECTION">
<div style="font-family:Calibri; font-size:11pt; text-align:left; color:black; BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: #b5c4df 1pt solid; BORDER-RIGHT: medium none; PADDING-TOP: 3pt">
<span style="font-weight:bold">From: </span>Ishita Dasgupta <<a href="mailto:ishita.dasgupta@gmail.com">ishita.dasgupta@gmail.com</a>><br>
<span style="font-weight:bold">Date: </span>Friday, May 26, 2017 at 9:38:00<br>
<span style="font-weight:bold">To: </span>Jeff Thompson <<a href="mailto:jefft0@remap.ucla.edu">jefft0@remap.ucla.edu</a>><br>
<span style="font-weight:bold">Cc: </span>"<a href="mailto:ndn-interest@lists.cs.ucla.edu">ndn-interest@lists.cs.ucla.edu</a>" <<a href="mailto:ndn-interest@lists.cs.ucla.edu">ndn-interest@lists.cs.ucla.edu</a>><br>
<span style="font-weight:bold">Subject: </span>Re: [Ndn-interest] download a file using PyNDN<br>
</div>
<div><br>
</div>
<div>
<div>
<div dir="ltr">
<div class="gmail_default" style="font-family:tahoma,sans-serif">Hi Jeff, </div>
<div class="gmail_default" style="font-family:tahoma,sans-serif"><br>
</div>
<div class="gmail_default" style="font-family:tahoma,sans-serif">I have a file test.txt being served on my ndnfs server. Prefix: /ndn/broadcast/ndnfs</div>
<div class="gmail_default" style="font-family:tahoma,sans-serif">I implement SegmentFetcher in the following way and print content and error message <br>
<br>
</div>
<blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">
 name3 = Name(url)<br>
<span class="gmail-s1"> dump(</span><span class="gmail-s2">"Express name "</span><span class="gmail-s1">, name3.toUri())<br>
</span> interest = Interest(name3)<br>
 dump(interest.toUri())<br>
<span class="gmail-s1"> interest.setInterestLifetimeMilliseconds(</span><span class="gmail-s2">1000</span><span class="gmail-s1">)<br>
</span><span class="gmail-s1" style="color:rgb(77,47,45);font-family:Courier;font-size:12px">SegmentFetcher.fetch(face, interest,
</span><span class="gmail-s3" style="font-family:Courier;font-size:12px">None</span><span class="gmail-s1" style="color:rgb(77,47,45);font-family:Courier;font-size:12px">, counter.onComplete, counter.onError)</span> </blockquote>
<div class="gmail_default" style="font-family:tahoma,sans-serif"><br>
</div>
<div class="gmail_default" style="font-family:tahoma,sans-serif">This is what i get: </div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<span style="font-family:tahoma,sans-serif">/ndn/broadcast/ndnfs/BigBuckBunny_4s_simple_2014_05_09.mpd?ndn.MustBeFresh=true <br>
</span><span style="font-family:tahoma,sans-serif">onError<br>
</span><span style="font-family:tahoma,sans-serif">2<br>
</span><span style="font-family:tahoma,sans-serif">Got an unexpected packet without a segment number: /ndn/broadcast/ndnfs/BigBuckBunny_4s_simple_2014_05_09.mpd/%C1.FS.file/%FDY%28Q8</span></blockquote>
<div><br>
</div>
<div class="gmail_default" style="font-family:tahoma,sans-serif">When I do an ndndump on the consumer, I see: </div>
<div class="gmail_default" style="font-family:tahoma,sans-serif">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<span class="gmail-s1">1495816236.074843 From: 192.1.242.150, To: 192.1.242.151, Tunnel Type: TCP, INTEREST: /ndn/broadcast/ndnfs/BigBuckBunny_4s_simple_2014_05_09.mpd?ndn.ChildSelector=1&ndn.MustBeFresh=1&ndn.InterestLifetime=1000&ndn.Nonce=3797640908</span> </blockquote>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
 </blockquote>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<span class="gmail-s1"></span><span class="gmail-s1">1495816236.085709 From: 192.1.242.151, To: 192.1.242.150, Tunnel Type: TCP, DATA: /ndn/broadcast/ndnfs/BigBuckBunny_4s_simple_2014_05_09.mpd/%C1.FS.file/%FDY%28Q8</span></blockquote>
<div><br>
</div>
<div>I thought fetching segment number was internally done in your Segment Fetcher util. Do I need to implement it some way on my end as well? </div>
</div>
</div>
<div class="gmail_extra"><br clear="all">
<div>
<div class="gmail_signature" data-smartmail="gmail_signature">
<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div dir="ltr"><font face="tahoma,sans-serif"><span style="font-size:12.8000001907349px">Regards,</span><br style="font-size:12.8000001907349px">
<span style="font-size:12.8000001907349px">Ishita Dasgupta</span><br style="font-size:12.8000001907349px">
<i style="font-size:12.8000001907349px">Graduate Student<br>
</i><i><font size="2"><span>College</span> of <span>Information</span> and <span>Computer</span> <span>Sciences</span></font></i><i style="font-size:12.8000001907349px">,<br>
UMass Amherst</i><br style="font-size:12.8000001907349px">
<i style="font-size:12.8000001907349px">Email</i><span style="font-size:12.8000001907349px">:
<a href="mailto:ishitadg@cs.umass.edu" target="_blank">ishitadg@cs.umass.edu</a></span></font><br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<br>
<div class="gmail_quote">On Thu, May 25, 2017 at 2:15 PM, Thompson, Jeff <span dir="ltr">
<<a href="mailto:jefft0@remap.ucla.edu" target="_blank">jefft0@remap.ucla.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word;color:rgb(0,0,0);font-size:14px;font-family:Calibri,sans-serif">
<div>Hi Ishita,</div>
<div><br>
</div>
<div>We have NDNFS producing sample data at <a href="http://memoria.ndn.ucla.edu" target="_blank">
memoria.ndn.ucla.edu</a>. The PyNDN code below uses the SegmentFetcher to fetch the segments of a file (a JavaScript file). NDNFS has split the file into 12 segments, which SegmentFetcher retrieves to supply the content to the callback. SegmentFetcher documentation
 is here:</div>
<div><a href="https://github.com/named-data/PyNDN2/blob/master/python/pyndn/util/segment_fetcher.py#L142" target="_blank">https://github.com/named-data/<wbr>PyNDN2/blob/master/python/<wbr>pyndn/util/segment_fetcher.py#<wbr>L142</a> </div>
<div><br>
</div>
<div>- Jeff T</div>
<div><br>
</div>
<div>
<div>import time, sys</div>
<div>from pyndn import Name, Interest, Face</div>
<div>from pyndn.util import SegmentFetcher</div>
<div><br>
</div>
<div>face = Face("<a href="http://memoria.ndn.ucla.edu" target="_blank">memoria.ndn.ucla.edu</a>")</div>
<div>SegmentFetcher.fetch(face, Interest(Name(</div>
<div>  "/ndn/edu/ucla/remap/demo/ndn-<wbr>js-test/<a href="http://named-data.net/wp-includes/js/jquery/jquery.js/%FDX%DC5B" target="_blank">named-data.net/wp-<wbr>includes/js/jquery/jquery.js/%<wbr>FDX%DC5B</a>")),</div>
<div>  None, lambda content: sys.stdout.write(content.<wbr>toRawStr()),</div>
<div>  lambda errorCode, message: sys.stdout.write("Got error " + message))</div>
<div><br>
</div>
<div>while True:</div>
<div>    face.processEvents()</div>
<div>    time.sleep(0.01)</div>
</div>
<div><br>
</div>
<div><br>
</div>
<span id="m_-584098919483880819OLK_SRC_BODY_SECTION">
<div style="font-family:Calibri;font-size:11pt;text-align:left;color:black;BORDER-BOTTOM:medium none;BORDER-LEFT:medium none;PADDING-BOTTOM:0in;PADDING-LEFT:0in;PADDING-RIGHT:0in;BORDER-TOP:#b5c4df 1pt solid;BORDER-RIGHT:medium none;PADDING-TOP:3pt">
<span style="font-weight:bold">From: </span>Ishita Dasgupta <<a href="mailto:ishita.dasgupta@gmail.com" target="_blank">ishita.dasgupta@gmail.com</a>><br>
<span style="font-weight:bold">Date: </span>Thursday, May 25, 2017 at 6:00:00<br>
<span style="font-weight:bold">To: </span>Jeff Thompson <<a href="mailto:jefft0@remap.ucla.edu" target="_blank">jefft0@remap.ucla.edu</a>>, "<a href="mailto:ndn-interest@lists.cs.ucla.edu" target="_blank">ndn-interest@lists.cs.ucla.<wbr>edu</a>" <<a href="mailto:ndn-interest@lists.cs.ucla.edu" target="_blank">ndn-interest@lists.cs.ucla.<wbr>edu</a>><br>
<span style="font-weight:bold">Subject: </span>Re: [Ndn-interest] download a file using PyNDN<br>
</div>
<div>
<div class="h5">
<div><br>
</div>
<div>
<div>
<div dir="ltr">
<div>Hi Jeff, </div>
<div><br>
</div>
<div>Yes
<div class="gmail_default" style="font-family:tahoma,sans-serif;display:inline">​, the producer is responding to Interests with Data packets representing the file. I run NDNFS on the producer.</div>
</div>
<div>
<div class="gmail_default" style="font-family:tahoma,sans-serif;display:inline">​</div>
<br>
<div class="gmail_quote">
<div>On Wed, May 24, 2017 at 4:35 PM Thompson, Jeff <<a href="mailto:jefft0@remap.ucla.edu" target="_blank">jefft0@remap.ucla.edu</a>> wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word;color:rgb(0,0,0);font-size:14px;font-family:Calibri,sans-serif">
<div>Hi Ishta,</div>
<div><br>
</div>
<div>In NDN, there is a producer and consumer. The consumer sends an Interest and the producer (or a cache in the network) responds with a Data packet. When you say “an entire file from an NDN server” I assume you mean a producer that is responding to Interests
 with Data packets representing the file. What producer software is running on the server?</div>
<div><br>
</div>
<div>- Jeff T</div>
<div><br>
</div>
<span id="m_-584098919483880819m_-8976340295034124263m_7103723139979724157OLK_SRC_BODY_SECTION">
<div style="font-family:Calibri;font-size:11pt;text-align:left;color:black;BORDER-BOTTOM:medium none;BORDER-LEFT:medium none;PADDING-BOTTOM:0in;PADDING-LEFT:0in;PADDING-RIGHT:0in;BORDER-TOP:#b5c4df 1pt solid;BORDER-RIGHT:medium none;PADDING-TOP:3pt">
<span style="font-weight:bold">From: </span>Ndn-interest <<a href="mailto:ndn-interest-bounces@lists.cs.ucla.edu" target="_blank">ndn-interest-bounces@lists.cs<wbr>.ucla.edu</a>> on behalf of Ishita Dasgupta <<a href="mailto:ishita.dasgupta@gmail.com" target="_blank">ishita.dasgupta@gmail.com</a>><br>
<span style="font-weight:bold">Date: </span>Wednesday, May 24, 2017 at 8:29:00<br>
<span style="font-weight:bold">To: </span>"<a href="mailto:ndn-interest@lists.cs.ucla.edu" target="_blank">ndn-interest@lists.cs.ucla.ed<wbr>u</a>" <<a href="mailto:ndn-interest@lists.cs.ucla.edu" target="_blank">ndn-interest@lists.cs.ucla.ed<wbr>u</a>><br>
<span style="font-weight:bold">Subject: </span>[Ndn-interest] download a file using PyNDN<br>
</div>
</span></div>
<div style="word-wrap:break-word;color:rgb(0,0,0);font-size:14px;font-family:Calibri,sans-serif">
<span id="m_-584098919483880819m_-8976340295034124263m_7103723139979724157OLK_SRC_BODY_SECTION">
<div><br>
</div>
<div>
<div>
<div>
<div class="gmail_default" style="font-family:tahoma,sans-serif">Hi All, </div>
<div class="gmail_default" style="font-family:tahoma,sans-serif"><br>
</div>
<div class="gmail_default" style="font-family:tahoma,sans-serif">Has anybody used PyNDN to download an entire file from an ndn server?</div>
<div class="gmail_default" style="font-family:tahoma,sans-serif">I see or receive jibberish data in form of one data packet but don't seem to copying the exact content of the file(no matter the size, i.e irrespective of the fact that the file gets divided to
 multiple segments or just one segment).</div>
<div class="gmail_default" style="font-family:tahoma,sans-serif">Any guidance with this would be helpful.</div>
<div class="gmail_default" style="font-family:tahoma,sans-serif"><br>
</div>
<div class="gmail_default" style="font-family:tahoma,sans-serif">Thanks,</div>
<div class="gmail_default" style="font-family:tahoma,sans-serif">Ishita</div>
<div>
<div class="m_-584098919483880819m_-8976340295034124263m_7103723139979724157gmail_signature" data-smartmail="gmail_signature">
<div>
<div>
<div></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</span></div>
</blockquote>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</span></div>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</span>
</body>
</html>