I am making a program which sends UDP packets to a server at a fixed interval, something like this:
while (!stop) {
Sleep(fixedInterval);
send(sock, pkt, payloadSize, flags);
}
However the periodicity cannot be guaranteed because send
is a blocking call (e.g., when fixedInterval
is 20ms, and a call to send
is > 20ms ). Do you know how I can turn the send
into a non-blocking operation?