3

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.

UPDATE:

I have added my comments below.

jkstar
  • 467
  • 2
  • 7
  • 19
  • http://stackoverflow.com/questions/15825298/android-udp-packet-loss – Amit Prajapati Aug 23 '13 at 11:10
  • My application has to receive udp packets of size 64 bytes. The issues is not that It loses all packets. It loses some packets but device is receving that which I found when I captured the network traffic of the device using shark app. It looks like Android OS is not sending those packets to my application from the WiFi network buffer. – jkstar Aug 23 '13 at 12:10

2 Answers2

3

I'd tell you a UDP joke, but you might not get it.

Packet loss is a documented feature of the UDP protocol.

UDP protocol does not guarantee that the package will be delivered to the addressee. http://en.wikipedia.org/wiki/User_Datagram_Protocol

ashakirov
  • 12,112
  • 6
  • 40
  • 40
2

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.

jkstar
  • 467
  • 2
  • 7
  • 19