Android never receives UDP packet?

If you're using an emulator you need to be aware of how networking on the emulator works. Most specifically: Each instance of the emulator runs behind a virtual router/firewall service that isolates it from your development machine's network interfaces and settings and from the internet.An emulated device can not see your development machine or other emulator instances on the network. Instead, it sees only that it is connected through Ethernet to a router/firewall.

You'll probably need to set up port forwarding, either using the Emulator console or using the adb command.

It fails on the actual device, too... it always timeouts, in the emulator as well as in the actual device. It works fine on the development machine in a normal java environment. And I can access the internet on android... – Quandary Jan 20 '10 at 13:54.

UDP works fine. I don't think your server is sending a response because your outgoing packet doesn't contain the bytes you think it contains. See my comments in the android bug you raised (code.google.com/p/android/issues/detail?...).

Byte buf = new byte256; socket = new DatagramSocket(port); DatagramPacket packet = new DatagramPacket(buf, buf. Length); socket. Receive(packet); Above worked for me... Your buffer seems large?

Might be a little far fetched but what are you trying to receive from? If you are trying to communicate with a XP machine that has two network cards (one could be wired and the other wireless, any mix) and you are are using XP built in firewall? Then UDP requests are only listened for on the first network on the computer, disable other network cards on your system, only have enabled the one that your trying to talk your Android device to.

1024*100 = 100 kb. That's not much. I also tried on android directly, not the emulator, but same result there.

I'll try with 256 bytes, however. – Quandary Jan 20 '10 at 14:36 Noting jarnbjo's comment the sample code above worked with my device connected via WiFi not via the cell network. – optics Jan 20 '10 at 14:50 I'll try that when I'm back home and have wifi – Quandary Jan 20 '10 at 15:52 still doesn't work – Quandary Jan 20 '10 at 20:06.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions