简体   繁体   中英

Android fails to send Multicast UDP datagrams

I have run into a strange problem when coding a simple UDP broadcast app for Android.

Basically my app wants to broadcast a stream of data to devices on the local network. Each UDP packet has a number which is incremented sequentially so I know when a packet is lost.

When I did a test, I noticed that around 80 percent of my packets got lost. Now I know UDP is lossy, but this is insane on a LAN.

So I coded the very same sender on JRE7 and launched it. The very same code had near zero percent loss.

When I switched to unicast (simply changing the destination IP address, no code change) on Android, I got a 0 percent loss rate.

With Unicast Im a little worried about the scalability of the application.

Does anyone know if there some known bug in Android which causes problems while sending multicast datagrams?

Im fairly certain it is not the receiver at fault as I use the same one for unicast and broadcast receival.

Thanks for your thoughts.

Same happens to me... Dont know why yet.. Try smaller packages and an inverse ack on the client and a ack listener on the server if you need it to be broadcast .. If you find a better solution I am asking almost the same on another post... I have managed the packet loss whit the inverse ack code but I am getting poor performance because of that. Note: I can not add comments because of reputation

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM