I’m wanting to use DatagramSocket and DatagramPacket to talk between two Android devices. Looking at the example here:
http://www.helloandroid.com/tutorials/simple-udp-communication-example
It looks fairly straightforward. However, what I would like to do is send packets between a device providing a WiFi tethering hotspot and a device connected to that hotspot.
I think it’s similar to this question:
https://stackoverflow.com/questions/6364630/android-wifi-tether-and-usb-tether-subnet-connections
But that question got no responses. 🙁 Does anyone have any info on how I would go about this?
This is actually a simpler question than the one that got no answers, which was about bridging two separate tethering sub-networks.
To your Wifi-tethered device, the Android device is the gateway. The Android device will have multiple network interfaces up: the loopback, the cell network, and the Wifi network. If your tethered device sends to the Android’s address on the Wifi network, and the app on the Android device binds its socket to the address on its Wifi network, they should be able to communicate fine.