Monday, May 9, 2011

Android: UDP Receiver

For my android app, I needed a UDP receiver which can receive broadcast packets. So I tried to create a UDP socket using the following.

mySocket = new DatagramSocket(PORT, ADDRESS);


But this socket could only receive unicast packets not the broadcast ones. I had to change it as follows to make it work for broadcast.

mySocket = new DatagramSocket(PORT);

0 comments:

Post a Comment