named-data / python-ndn

An NDN client library with AsyncIO support in Python 3
https://python-ndn.readthedocs.io/en/latest
Apache License 2.0
24 stars 17 forks source link

Making an Interest to Express #26

Closed justincpresley closed 3 years ago

justincpresley commented 3 years ago

In one application that I am forming using this python NDN library, it is necessary to measure the size of the interest before expressing it. To accomplish this, I plan to make an 'Interest' and then express it after created manually.

I noticed though that there is no way to express a Interest that is created manually, you have to let the library create it through "express_interest".

name = Name.from_str("/data/section/1")
interest = make_interest(name, InterestParam(can_be_prefix=True, must_be_fresh=True, lifetime=6000))
                        # also where is need_raw_packet? app_params?
_, _, _, pkt = await app.express_interest(interest)

is there a method to decode a manually created Interest so that "express_interest" can use it?

zjkmxy commented 3 years ago

Let me write a function for you.

zjkmxy commented 3 years ago

Should be fixed in 00fdfd9. Reopen this issue if it does not work. Please contact me when you need a release.