TCP Graceful shutdown: Socket shutdown() function missing
I have to gracefully close a TCP socket on the client side: Send data, initialize the finish handshake and wait until the the server has finished the handshake. It works without Qt like this:
@Call shutdown with how=SD_SEND.
Call recv() until the function completes with success and indicates zero bytes were received. If SOCKET_ERROR is returned, then the graceful disconnect is not possible.
more infos: http://blog.netherlabs.nl/articles/2009/01/18/the-ultimate-so_linger-page-or-why-is-my-tcp-not-reliable
I tried it with:
But this doesn't work of course. Is this possible with QTcpSocket? disconnectFromHost() only uses closesocket(). So if the link is lost all functions will still return success but zero data will be send.
Interesting question while a bit low level, I think you should bring it to the interest mailing, you'll find Qt's developers/maintainers there (this forum is more user oriented)
thanks for pointing me to the interest mailing list.
I am wondering why you are not deleting the object after your disconnectFromHost ?