QTcpSocket & livetime & deletion
-
wrote on 9 May 2021, 22:31 last edited by
Hey!
2 Cases
QTcpSocket = QTcpSocket::connectToHost()
and QTcpServer : nextPendingConnection()
Both of them are sockets with conections.
The question I have... if I deleteLater() the sockets, do the connection get automatically disconnected, or do they remain active?Secondly if I set option,
QAbstractSocket::KeepAliveOption
, does the connection then remain active after I delete socket?Just trying to understand some odd cases where I delete socket and my server/client still remains connected...
TIA
-
Hey!
2 Cases
QTcpSocket = QTcpSocket::connectToHost()
and QTcpServer : nextPendingConnection()
Both of them are sockets with conections.
The question I have... if I deleteLater() the sockets, do the connection get automatically disconnected, or do they remain active?Secondly if I set option,
QAbstractSocket::KeepAliveOption
, does the connection then remain active after I delete socket?Just trying to understand some odd cases where I delete socket and my server/client still remains connected...
TIA
@Dariusz said in QTcpSocket & livetime & deletion:
if I deleteLater() the sockets, do the connection get automatically disconnected, or do they remain active?
-
wrote on 10 May 2021, 02:12 last edited by
TCP will disconnect after a standard timout in lieu of an explicit close. setsockopt() can set the timeout.
-
Hey!
2 Cases
QTcpSocket = QTcpSocket::connectToHost()
and QTcpServer : nextPendingConnection()
Both of them are sockets with conections.
The question I have... if I deleteLater() the sockets, do the connection get automatically disconnected, or do they remain active?Secondly if I set option,
QAbstractSocket::KeepAliveOption
, does the connection then remain active after I delete socket?Just trying to understand some odd cases where I delete socket and my server/client still remains connected...
TIA
@Dariusz said in QTcpSocket & livetime & deletion:
if I deleteLater() the sockets, do the connection get automatically disconnected, or do they remain active?
-
@Dariusz said in QTcpSocket & livetime & deletion:
if I deleteLater() the sockets, do the connection get automatically disconnected, or do they remain active?
4/4