简体   繁体   中英

Sending regularly many UDP-Datagrams in a thread sometimes results in micro packetbursts

We are trying to send UDP-Datagrams in Android 7.0 per Wifi to a server. The Datagram-size is 23 Bytes and the frequency is around 15 milliseconds.

We have a Queue into which we put ByteArrays. Another Sending-Thread pulls those Arrays from the threadsafe Queue and sends them in Datgrams through a Datagramsocket to a server. The socket.send()-method is called every 10-18 ms.

The Wireshark on the serverside receives most of the packets in a nice regular stable interval of roughly 15ms, but sometimes (mostly every 150-300 packets) there is a lag of 1-3 sending cycles and then the delayed packets arrive in a "burst" after a pause of 30-60 ms.

The delays get longer and appear significantly much more often if at runtime we try to put stress on the android phone with Network-Intensive tasks ( when we start a WiFi-Analyser-App ).

Increasing the ThreadPriority of the Sender-Thread doesn't seem to have any effect on the problem.

If anybody can help me with some hints on how to have more control over the networkinterface-sending-process in order to reduce the bursts and get a more stable regular sending-interval, me and my mates would be very very thankful.

Ok . We found it out. The Problems were caused by some of the standard-services in the background like Bluetooth if I remember correctly ( maybe it was also Wifi or GPS, it was quite some time ago to rember correctly ). The service seeked for signals and their strenghts every few seconds, and by doing that disrupted our packetpipeline.

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