Scenario:
Using Boost Asio 1.69 I have a C++ server running on Linux Fedora 4.9 and a client running on an Android 10 phone using a peer to peer connection. There is continuous sending of data from server to client and occasionally a packet from client to server.
Problem:
Things work well but due to my Server sending many packets at a high rate, my client is unable to catch up. This causes packets to get dropped. Digging deep and reading about the problem, I learnt that there is something called UDP packets pacing. Another link here. This seems to me as a potential solution to my problem. At least something I want to try to avoid the burst of flow of UDP packets and rather try smoothen the flow.
So I tried the following firstly:
uint32_t bytes_per_second = 1000000;
if(setsockopt(udp_socket, SOL_SOCKET, SO_MAX_PACING_RATE, &bytes_per_second, sizeof(bytes_per_second)) < 0) {
std::cout << "Unable to set socket max pacing rate" << std::endl;
}
But above does not seem to have any affect. I different numbers set for bytes_per_second
with no helpful effect and the problem stayed the same.
Question:
How can I effectively exercise UDP packets pacing? Or how can I ensure a slight gap between the packets I am sending from my Linux server side?
Is it a linux configuration I could do or is it something I could do by calling setsockopt on the udp socket? Any suggestions towards potential investigations are also welcome!