I\'ve implement simple udp server on my Android device.(sdk 1.5) it works fine when I am running a local client on the phone sends through it trigger to my server.
b
At a guess, I'm assuming that when you call InetAddress.getByName("localhost")
, you are getting the loopback address (127.0.0.1).
What you actually want to do is to have the socket bound to INADDR_ANY, which you can apparently achieve by creating your DatagramSocket
like so:
socket = new DatagramSocket(SERVERPORT);