Force Android To Send Udp Packets Immediately?
Solution 1:
As far as Java is concerned, once DatagramSockect.send(...) has been called, the datagram is "sent". There is no buffering in Java application space, and no way to control any buffering in the OS.
It is unlikely that either TCP or UDP is "holding back" packets. It is far more likely that the root problem is something at the WiFi level ... or possibly with routing ... and the OS is delaying sending the packets until the problem resolves itself.
Thanks, I now implemented sending those keep-alive packets only if there was no other packet sent during that time.
It sounds like your keep-alive pings are having the desired effect ... and from that I infer that the root problem is / was that the WiFi "link" was being dropped due to inactivity. (It sounds like a "don't drain the battery" feature ...) This suggests that an alternative fix would be to see if you can tweak the WiFi timeout.
Besides that, would it be faster to send packets to another port, on which nobody is listening? It should still have the same effect without, right?
It is unlikely to make any difference. There is no evidence that the problem is caused by congestion. The evidence points to your phone turning off inactive WiFi to save power ...
Post a Comment for "Force Android To Send Udp Packets Immediately?"