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.
Call closesocket().@from: http://msdn.microsoft.com/en-us/library/windows/desktop/ms740481(v=vs.85).aspx
more infos: http://blog.netherlabs.nl/articles/2009/01/18/the-ultimate-so_linger-page-or-why-is-my-tcp-not-reliableI tried it with:
@disconnectFromHost ();
read();@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.
Thanks
-
Hi,
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)
-
Hi, SGaist,
thanks for pointing me to the interest mailing list.