Android Example Part 1: UDP Text Communication: Same Network

Hi there

I've just finished my first try with UDP, wow. With the attached code I have managed to get the app installed on two different android devices, connected them to the same wifi, established a connected and let them speak together. It's actually easier than I thought.

I also tested this with Genymotion and I was able to send from my PC but communication from the device didnt come through. My genymotion device network connection is bridged via VirtualBox.

I was intending to add a 'polling' timer to fetch data at intervals from the connected device but didnt come around it yet. It would be interesting to have this working on public ip addresses though. Will search b4x for that.

Attached is the source code. (See manifest for permissions)
 

Attachments

  • UDP.zip
    5.1 KB · Views: 996
  • udp.png
    udp.png
    47 KB · Views: 962

roycegerikchua

Member
Licensed User
Longtime User
hi @Mashiane if you want UDP connections to work outside of your local network, you would have to open that port from your router and point that port to the ip address you want the data to get delivered to. also you have to use the OUTSIDE (WAN) IP address of the router to get it working...
 

mbayik

Member
Licensed User
hi Mashiane, i couldn't start your source it says "Undeclared variable 'statemanager' is used before it was assigned any value."
 
Top