[Ndn-lib] PyNDN UdpTransport: specify local port

Junxiao Shi shijunxiao at email.arizona.edu
Sat Apr 21 15:38:22 PDT 2018

Dear folks

I have a suggestion for PyNDN's UdpTransport: the application should be
allowed to specify a local port number.

Use case: UdpTransport is typically used when the host running PyNDN
application does not have a forwarder. In order for the application to
serve content, it must register a prefix to receive Interests. Although the
application could send a prefix registration command to the remote
forwarder, it's not trivial to configure the keychain, and the application
would also need to periodically refresh the prefix registration. On the
other hand, when the operator has control over the remote forwarder as
well, it is much more convenient to setup a route on the forwarder toward
the application. However, this is possible only if the application's IP
address and port number are known.

Suggested API:

1. In UdpTransport.ConnectionInfo class constructor, add a named parameter
'localPort'. Its default value is None.
2. In UdpTransport.connect method, if localPort is not None, call
self._socket.bind(("", localPort)).
3. In case bind fails, raise an exception and let the caller handle it.

Yours, Junxiao
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/ndn-lib/attachments/20180421/82084f50/attachment.html>

More information about the Ndn-lib mailing list