Hello people I just programming a server / client
Data exchange with QT5 .5 and i get a question.
how can the server know that the client has closed the connection?
Hello people I just programming a server / client
Data exchange with QT5 .5 and i get a question.
how can the server know that the client has closed the connection?
Here is a good video series to get you started with understanding how networking works.
https://www.youtube.com/watch?v=XaGX...oG3oKSuOcw_XeW
I'm starting out with networking myself, so will be listening in to the responses .
Assuming your server is implemented with QTcpServer, every time a new client connects your code should call QTcpServer::nextPendingConnection() to obtain a QTcpSocket through which to communicate with the client. When the client disconnects, the QTcpSocket first emits error(QAbstractSocket::RemoteHostClosedError), then disconnected(). All you have to do is connect those signals to slots that handle the situation.
Bookmarks