<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>Hi Ishita,</div>
<div><br>
</div>
<div>We have NDNFS producing sample data at memoria.ndn.ucla.edu. 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">https://github.com/named-data/PyNDN2/blob/master/python/pyndn/util/segment_fetcher.py#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("memoria.ndn.ucla.edu")</div>
<div>SegmentFetcher.fetch(face, Interest(Name(</div>
<div>  "/ndn/edu/ucla/remap/demo/ndn-js-test/named-data.net/wp-includes/js/jquery/jquery.js/%FDX%DC5B")),</div>
<div>  None, lambda content: sys.stdout.write(content.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="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>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">jefft0@remap.ucla.edu</a>>, "<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>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_-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.<wbr>cs.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.<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>[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_-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_-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>
</span>
</body>
</html>