Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
What does QAbstractSocket::KeepAliveOption actually do?
Vadi2 last edited by Vadi2
The documentation is a bit unclear, but if I enable
QAbstractSocket::KeepAliveOptionon a TCP socket, will it automatically send the keepalive packets for me?
as the docs also state it sets the
SO_KEEPALIVEoption on the underlying platform socket.
So you should look up this option for your target platform.
Vadi2 last edited by
What does that practically mean on Windows/Linux/macOS?
JonB last edited by JonB
SO_KEEPALIVEvaries enormously between various OSes, different TCP stacks, etc. You really do have to do a lot of reading (e.g. @raven-worx's link, stackoverflow etc.) if you really know what it might or might not do.
My experience (maybe a bit old now)? Don't rely on it to do anything.
Or, in particular: I used to use to (try to) keep a connection from timing out. In practice, far from that, what it actually did was: caused my app to notice that a connection had become lost, and so complain, when had I not used it then the app wouldn't have noticed a lost connection till I sent/received, and by then might have silently re-established the connection without complaint. So I gave up on it!