sending data packet just before closing socket

Posted by xopht on Stack Overflow See other posts from Stack Overflow or by xopht
Published on 2010-05-28T07:58:05Z Indexed on 2010/05/28 8:02 UTC
Read the original article Hit count: 263

Before disconnect the client, the server wants to send some info to the client - why do I(server) disconnect you(client).

If I send packet to the info and close the client socket immediately, closesocket() returns -1 and if I use linger option to work closesocket() successfully, the info cannot be sent completely.

How can I complete this and is it possible to know socket buffer is empty(means my packet sent all)?

thx.

© Stack Overflow or respective owner

Related posts about c++

Related posts about socket-programming