Android的UDP数据包丢失 [英] Android udp packets loss

查看:295
本文介绍了Android的UDP数据包丢失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在收到关于索尼Xperia平板ŽUDP数据包所面临奇怪的问题。我的应用程序并没有得到很多UDP数据包。所以我扎根安装鲨鱼应用平板电脑和捕获鲨鱼用生根应用设备后,网络流量。当我分析报告中,该设备已接收到的所有数据包,但我的申请没有得到很多。如果应用程序没有收到任何数据包,问题可能是数据包过滤器以阻止广播包。在这里,我的应用程序接收到几个包,但错失了设备接收的数据包。我还没有发现与三星选项卡并在它接收的所有数据包摩托罗拉Xoom平板电脑这个问题。这听起来像没有code问题。任何人都面临着类似的问题?让我知道如果您有任何建议或投入,我可以试试。

I am facing weird problem in receiving udp packets on Sony Xperia Z tablet. My application didn't receive many udp packets. So I have rooted the tablet to install the shark app and captured the network traffic using shark app after rooting the device. When I analyzed the report, the device has received all the packets but my application did not receive many of them. If the application didn't receive any packets, issue could be the packet filter which blocks broadcast packets. Here, my application receives few packets but misses packets received by device. I have not observed this issue with samsung tab 2 and motorola xoom tablet where it receives all the packets. It sounds like there is no code issue. Have anybody faced similar problem? Let me know if you have any suggestions or inputs that I can try.

更新:

我在下面加了我的意见。

I have added my comments below.

推荐答案

我发现,为什么我的应用程序错过了设备接收的一些数据包。我已经设置数据报套接字接收缓冲区大小,以较小的值。我删除这个code设置缓冲区的大小,然后将其strated receving所有数据包。默认情况下,Android的设置缓冲区大小为163840B,但我设置大小为64字节。它工作正常使用Android默认设置缓冲区的大小。

I have found why my app missed some packets received by device. I have set datagram socket receiver buffer size to small value. I removed this code setting buffer size and then it strated receving all the packets. By default, android sets buffer size as 163840B but I set the size to 64 bytes. It is working fine with default buffer size set by android.

这篇关于Android的UDP数据包丢失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆