Help with Android Networking

Started by
5 comments, last by hplus0603 11 years, 4 months ago

Hey guys,

I'm going to be createing a networked Android application, I just want to create a very simple and straight forward application where one user can become a wifi hot-spot while the other user connects to that wifi hot-spot, I don't know much about networking programming, but I have read a lot about networking. I'm just interested in any tutorial websites you guys may know, or any information that will help, I do understand that Android using Java, but Android API does offer somethings that Java doesn't,

I understand this forum is for more "programming" problems, but I just need some help with getting started with Android Network programming, any websites or documents on the web that would help me

Cheers for the help

Canvas

Advertisement

Here's an post on ad-hoc networks in Android and here's the documentation for Wi-Fi Direct (requires Android 4.0). There's this question and this one on StackOverflow which seem pretty relevant. These might help.

[size=2][ I was ninja'd 71 times before I stopped counting a long time ago ] [ f.k.a. MikeTacular ] [ My Blog ] [ SWFer: Gaplessly looped MP3s in your Flash games ]

Just a quick question, does android 3.0 have that much different from 4.0 android networking?

Not a ton. 4.0 has WiFi-Direct, network usage, VPN services, and Bluetooth health devices, which 3.0 lacks.

[size=2][ I was ninja'd 71 times before I stopped counting a long time ago ] [ f.k.a. MikeTacular ] [ My Blog ] [ SWFer: Gaplessly looped MP3s in your Flash games ]
Note that turning an Android into a "hotspot" generally requires a rooted device, because the cell phone carriers want to be able to charge for that service separately from "device" or "tethered" data usage.
enum Bool { True, False, FileNotFound };

My mobile device HTC desire can turn itself into a wifi hotspot, and a mobile can connect to it with no problem, just needs the pass key, then they are connected just like a router, I just need to program the application to use UDP to send out data to all connected peers that are on the same application :). As I stated above, any information will be appreciated.

Canvas

I just need to program the application to use UDP to send out data to all connected peers

Do you need a list of all connected peers, or just the ability to broadcast UDP on the local subnet?

For the latter, if your subnet is 192.168.1.0/255.255.255.0, then the broadcast address is 192.168.1.255. Create SOCK_DGRAM sockets on clients/server, and bind them to your chosen port number. Enable SO_BROADCAST on all the sockets (sending and receiving) and send the UDP datagram to the broadcast address; the clients will receive the packet (minus some small risk of UDP data loss.)
enum Bool { True, False, FileNotFound };

This topic is closed to new replies.

Advertisement