Task #2432
closedDetailed design on the interaction of NFD service and other applications.
Description
This task is to provide documentation (e.g., in ppt) for the detailed process on interaction between NFD service on android and NDN (jNDN) applications.
When application starts what does it do? assuming it makes a local TCP connection, does it also sends an intent to start NFD if it is not working? When connection breaks, what app should do to continue communication, etc.
Updated by Alex Afanasyev almost 10 years ago
- Project changed from ndn-embedded to NFD-android
- Category deleted (
Android)
Updated by Ivan Yeo almost 10 years ago
- File NFD Android Service and Process Interaction.pdf added
- % Done changed from 0 to 100
This is the current design for the NFD Android Service and its interaction with the NFD (Native) shared library. This design link can be found here:
https://docs.google.com/presentation/d/1B9tQIzcGLEhqMmSqYeYYfjaKPyfozW_CPI65ROQ0-n4/edit?usp=sharing
The key points can be summarized as such:
1) The NFD Service is a singleton and can only start once. Any other requests for startService() will be ignored when the service is already running.
2) The NFD Control Application has the choice to bind to the NFD Android Service to provide additional administrative commands, such as: killing of threads, saving of NFD in memory structures.
3) NFD Control application communicates with the NFD Service through Messages. This can be used for direct communications, such as to restart the NFD, kill of threads that are running or even to save the state of NFD in memory structures.
4) NDN Enabled applications can communicate with the NFD (Native) directly through TCP and UDP sockets that the NFD is listening on.
I have also attached a PDF for your convenience.
Updated by Alex Afanasyev almost 10 years ago
Google's presentation is better than pdf (no need to attach).
For slide 3, remove UDP. Local applications should use only TCP. You can add TCP/UDP to show external communication, but inside phone we not going to have UDP.
I would also combine slide 2 and 3. The point you want to make is that Face() constructor should attempt to connect to TCP first. If failed, send startNfd() intent (or just always send startNfd intent), then try again (or wait and try again).
Updated by Ivan Yeo almost 10 years ago
Yep, thanks for the input Alex! I've updated the following:
- Local apps to use only TCP.
- Combined slides 2 and 3
As for the startNfd() invocation, let's go with startService() Intent each time. In the future, we can provide a binding interface for NDN Enabled applications to check if the NFD Service is actually running. Such an interface will provide for a more deterministic behavior as the NFD Service can call back on the client to let the client know that the service is already running. Hence, we can eliminate the need to wait for an indefinite period of time.
Updated by Ivan Yeo almost 10 years ago
- File deleted (
NFD Android Service and Process Interaction.pdf)
Updated by Ivan Yeo almost 10 years ago
- Status changed from New to Resolved
The design has been completed and can be found at this link:
https://docs.google.com/a/g.ucla.edu/presentation/d/1B9tQIzcGLEhqMmSqYeYYfjaKPyfozW_CPI65ROQ0-n4/edit#slide=id.g629b23bb3_00
Answers to the questions set out in this Task is as follows:
When application starts what does it do?
NFD Control Application: When the NFD Control Application starts, it will first bind to the NFD Service and check if the NFD is currently being run by the NFD Service. If the NFD is not running, the user will be presented with the choice to start the NFD. If the NFD is running, the user will be presented with a choice to stop the NFD. If the user is viewing the app and the NFD Service is forcefully killed by the user or the OS, the app will continuously attempt to reconnect to the NFD Service.
For other NDN Enabled applications to use the NFD Service, an implicit startService() Android Intent must be sent to the Service. Once the service is started, the user will be able to use the jNDN client library to establish Face() connections with the locally running NFD through use of the TcpTransport(), which currently the default transport to be used when creating a Face() as of this writing.
Assuming it makes a local TCP connection, does it also sends an intent to start NFD if it is not working?
Sending of implicit startService() Android Intent is always necessary to ensure the NFD is up and running before attempting to make a connection to the locally running NFD.
Even if the developer were to do it the other way around, that is creating a Face() to connect to "localhost" before starting the NFD, the TCP connection would fail and an attempt should be made to start the NFD Service through the implicit startService() Android Intent.
When connection breaks, what app should do to continue communication, etc.
If connection breaks because of the termination of the NFD Service (by user or OS), the NFD Service will restart based on OS resource availability. The NFD Control Application will attempt to reconnect to the NFD Service if it is currently in the user's foreground view.
For NDN Enabled applications: When connection is lost, recovery of connection to the locally running NFD is left up to the choice of the NDN enabled application.
Updated by Ivan Yeo over 9 years ago
Design is completed. As of this writing, the design that has been discussed and implemented is located at: