Search code examples
androidsocketsudplte

send UDP packets over LTE from Android


I cannot figure out how to send a UDP packet over a 4G LTE network from an Android app (no WiFi). Does anyone have any ideas or know where I can find some documentation? I need to write two android apps, one client and one server, so that I can send UDP packets with timestamps from one device to the other. This is to test 4G LTE network latency from device to device.

Please help!

Thanks!


Solution

  • You can use the DatagramSocket class:

    This should work regardless of WiFi or mobile connection type, although you may find some mobile operators have some restrictions on UDP connections.