Hi all, I've got a thread in an application (Linux, Qt 5.13.0) which just
writes udp datagrams at a relatively high frequency (video streaming).
Sometimes the QUdpSocket::writeDatagram function returns -1 and the socket
error is "TemporaryError". Looking into the source code of the udp socket
class, it seems like the actual reason is that the OS returns EAGAIN which
means I need to try again.

The thread is a QThread running the default event loop.

What's the best way to handle this? Right now I just made a dumb loop
trying again and again with a short usleep inbetween until it finally ships
the datagram. I tried using waitForBytesWritten when getting the temporary
error before trying again, but that had no noticeable effect. Without a
sleep, this spinning loop might have some several 100 retries before it is
successful.

Cheers,
Ola
_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest

Reply via email to