ProjectSPAN / android-manet-manager

SPAN - Android Manet Manager
72 stars 37 forks source link

How to connect application to manet manager (use olsr) #25

Open romeldo opened 10 years ago

romeldo commented 10 years ago

We are 3 students doing a project which involves implementing middleware that should use olsr to find and establish neighbors. Our middleware uses multicast packets to find one hop neighbors and establish connections between them. We are using 3 rooted nexus 7's with a custom kernel installed. Should we be importing any classes from the manet manager or just using sockets is fine? We wrote a basic chat application on top of the middleware. So far we have been trouble with multicast packets. Does OLSR support multicast?

jrobble commented 10 years ago

Glad to hear about your project. If you have OLSR-specific questions you should post them on the OLSR forum: http://www.olsr.org/?q=mailing-lists

I'm not sure if OLSR supports multicast natively. Here is a plugin for it: http://sourceforge.net/projects/olsr-bmf/

You'll also run into a problem where Android doesn't support multicast normally. You'll might need to use a MulticastSocket: http://developer.android.com/reference/java/net/MulticastSocket.html

And a MulticastLock: http://www.whizzosoftware.com/forums/blog/1/entry-40-android-jmdns-and-wi-fi-multicast-packets/

On Tue, Mar 4, 2014 at 12:46 PM, romeldo notifications@github.com wrote:

We are 3 students doing a project which involves implementing middleware that should use olsr to find and establish neighbors. Our middleware uses multicast packets to find one hop neighbors and establish connections between them. We are using 3 rooted nexus 7's with a custom kernel installed. Should we be importing any classes from the manet manager or just using sockets is fine? We wrote a basic chat application on top of the middleware. So far we have been trouble with multicast packets. Does OLSR support multicast?

Reply to this email directly or view it on GitHubhttps://github.com/ProjectSPAN/android-manet-manager/issues/25 .

duhmojo commented 10 years ago

Typically routers won't blindly support multicast routing. OLSR is the same, though you might be able to work out a way to configure it to work. If you do, please share!

The OLSRD mailing list has been a waste of time in my experience. I think the entire team is working on their next generation version, but I've never had a response once. Even on compiling issues and basic build environment questions. If it wasn't for ManetManager and jrobble I would have hung myself a year ago. :-)

What I had to do was re-broadcast (multicast with a lock, if you're doing UDP broadcast you'll figure this out quick) received UDP packets from my Android app Service. It can get messy because there's a lot of echo you have to sort through. You'll broadcast to everyone within range, they'll receive the message, then re-broadcast it to everyone else in range, including the sender. The point is to re-broadcast to everyone on the other side of a route hop until everyone gets it.

I ended up with a UDP packet format that included a 16 byte header portion which had a device/session unique identifier (partially based on the sender's UUID) that a receiving device could use as an index for tracking already received packets. This way you can ignore packets you've already received, (eliminate the echo) and re-broadcast and process packets you haven't seen yet.

You might want to just base your broadcast communication on the OLSRD nearest neighbor list where you unicast UDP to only the neighbors, who will then re-broadcast unicast to the next nearest neighbor list, and so on. It will seriously cut down on the noise. (ManetManger has code you can look at for pulling OLSRD's txtinfo plugin information from port 2006)

I've found that a noisy Android adhoc network is prone to losing packets too easily. Make sure that the Wifi channels you're using near by don't conflict with what you're using for ManetManager. (2.4Ghz channel 1) It can cause unexpected UDP packet loss that you won't notice until later when you start digging into mysterious issues.

Good luck!

percyperezdante commented 9 years ago

RECEIVING MORE MESSAGE THAN EXPECTED. WHY? I am using MulticastSocket to multicast a message to 3 another mobiles. Each time a mobile multicast one message the receivers receive the same message 16 times. I am using datagrams for send and receive the packets. Should I use different approach to have a correct behavior? I would appreciate your advice or comments. Thank you for your time and nice to discover manet manager.