| * See COPYING for copyright and distribution information. |
| #include <ndn-cpp/interest.hpp> |
| #include <ndn-cpp/data.hpp> |
| #include <ndn-cpp/transport/udp-transport.hpp> |
| #include <ndn-cpp/face.hpp> |
| class MyClosure : public Closure { |
| virtual UpcallResult upcall(UpcallKind kind, UpcallInfo &upcallInfo) |
| if (kind == UPCALL_DATA || kind == UPCALL_DATA_UNVERIFIED) { |
| cout << "Got data packet with name " << upcallInfo.getData()->getName().to_uri() << endl; |
| for (unsigned int i = 0; i < upcallInfo.getData()->getContent().size(); ++i) |
| cout << upcallInfo.getData()->getContent()[i]; |
| return CLOSURE_RESULT_OK; |
| return CLOSURE_RESULT_OK; |
| int main(int argc, char** argv) |
| Face face("E.hub.ndn.ucla.edu", 9695, shared_ptr<UdpTransport>(new UdpTransport())); |
| face.expressInterest(Name("/ndn/ucla.edu/apps/ndn-js-test/hello.txt/level2/%FD%05%0B%16%7D%95%0E"), &closure); |
| while (!closure.gotContent_) |
| } catch (std::exception &e) { |
| cout << "exception: " << e.what() << endl; |