So I have 2 QT applications, one runs a QLocalServer and listens for a connection. Upon the other application (the client) connection it initializes a QLocalSocket. On the client side I just connect to the server. Is there any way for the client to detect when the server has closed? Right now if I close the server and the client keeps running, I get a SIGPIPE exception when I try to flush the socket.
Asked
Active
Viewed 507 times
1 Answers
0
Suppose you use sub-class inherited from QAbstractSocket, at least there are two way to handle connection lost.
SocketState QAbstractSocket::state() const ,
you could query the current state if you want. Second ,QAbstractSocket can trigger an signal :
void disconnected()
then you can define your own slot to handle the disconnection.

Dean Song
- 341
- 1
- 10