Android dtnsend equivalent
Hello,
I'm currently trying the ibr-dtn for android app. It works fine and I can ping the phone from a computer connected on the same network using WiFi.
I would now like to build my own DTN application in order to send bundles from the phone and receive them on a computer connected on the same network.
I have looked at the code from DTNExampleApp and ShareBox.
When I use the DTNExampleApp, I keep getting the following messages in the logs (from DTNClient) : - registration successful - Session not available, need to register.
I tried to build my own app nevertheless but it is stuck on the DTNClient.getSession() blocking call.
This is what I did :
DTNClient client = new DTNClient(); Registration registration = new Registration("dtnsendapp"); client.initialize(this, registration);
EID destination = new SingletonEndpoint("dtn://receiver.dtn/dtnrecvapp"); Bundle b = new Bundle(); b.setDestination(destination); b.setLifetime(3600L); b.setReportto(SingletonEndpoint.ME);
Session s = client.getSession(); <-- program hangs here
String payload = "Hello World"; BundleID ret = s.send(b, payload.getBytes());
NB : I removed the Try, Catch to make the example as readable as possible.
My question is : How do I send a bundle using the provided API?
Thank you, Jawad
Hello Jawad.
Am 21.02.2014 15:48, schrieb Jawad Seddar:
Session s = client.getSession(); <-- program hangs here
This call blocks until a valid session is available. You can disable the blocking by calling client.getSession(false). But this do not solve the issue that your application registration does not work.
Without the complete code or a magic 8 ball I can not tell you more. Check twice if you do the registration the same way it is done in the example app and do not create the DTNClient twice in the same application.
Kind regards, Johannes Morgenroth
participants (2)
-
Jawad Seddar
-
Johannes Morgenroth