views:

67

answers:

2

I a very new to Android. I need to make a connection with an UDP server by using my Android UDP client. Now I need to know how to work with UDP in Android? Please guide me to do this.

+3  A: 

You can work with UDP in Android applications just like in any Java app, with java.net.DatagramSocket and java.net.DatagramPacket. There's a short sample app available at http://www.anddev.org/udp-networking_-_within_the_emulator-t280.html

cristis
A: 

In my experience working with UDP on Android is similar to working with UDP on a normal Java application. Follow the example above and you should be okay. However, I would recommend that you do most of your testing on an actual device (if you have access to one) instead of the emulator. It took me some time to figure out that the emulator (at least the version I used) has a packet size limitation of about 8K.

Soumya Simanta