Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect other device IP #26

Open
wooof21 opened this issue Mar 6, 2014 · 5 comments
Open

Detect other device IP #26

wooof21 opened this issue Mar 6, 2014 · 5 comments

Comments

@wooof21
Copy link

wooof21 commented Mar 6, 2014

Hi, please help, how the project find the other device IP address when join the network? I ma trying to do broadcast some packet in the ad hoc, but seems every time it only send the packet to itself. I did some research, but all their broadcast packet are doing under Wifi network, and also their detect other device IP method are not appear in this project, I don't know its the reason that this project turn off wifi so that method won't work anymore or you find another way to do it. Can you give me some hint, thank you!

@jrobble
Copy link
Member

jrobble commented Mar 6, 2014

SPAN uses the OLSR routing protocol to form the network. Essentially Device A will broadcast a HELLO messages that Device B will here if it's in range. The same thing happens in the opposite direction and they form a link.

We turn off the Wi-Fi in the Settings app because we work below the Android OS and turn on ad-hoc mode in the kernel. Android doesn't natively support ad-hoc mode. You should still be able to send data in your apps even if the WifiManager (http://developer.android.com/reference/android/net/wifi/WifiManager.html) tells you that there is no network.

Try and form a network with two devices and click on the "Routing Info" option in the MANET Manager app. Please include the output in your next reply.

@wooof21
Copy link
Author

wooof21 commented Mar 6, 2014

Thank you for your replying, sir! I got the broadcast worked, but now the problem is, if want to send a unicast message to a device in the network, how I get that device IP? In your project, when a device join the network, in the visualizer it will automatic show the device IP, I don't know how you detect the other device IP address, can you also give a hint please?

@jrobble
Copy link
Member

jrobble commented Mar 7, 2014

The SPAN code pulls the IP address from the OLSR txtinfo plugin. You can use the SPAN API to get information about peers in the network. You need to use ManetHelper.sendPeersQuery(), which will invoke the callback ManetObserver.onPeersUpdated(). Refer to how the android-manet-ptt and android-manet-visualizer projects use those calls.

@superdav815
Copy link

Hi I am new to android programming doing networking project application to run on nexus7 tablet, can you give beginner step by step details on how to get the IP addresses and nexthop address from OLSR routing table. I unable to understand how android-manet-ptt is doing it.

@jrobble
Copy link
Member

jrobble commented Mar 24, 2014

The Manet PTT app is using the Manet Manager Service. The Manet Manager Service pulls a text dump from the running olsrd process using the OLSR txtinfo plugin. Refer to this code:

https://github.com/ProjectSPAN/android-manet-manager/blob/master/AndroidManetManager/src/org/span/service/routing/OlsrProtocol.java

Specifically, look at the InfoThread and getPeers() method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants