Hi all,

I have a non blocking socket that is being watched by an io watcher, and
when the connection is to be terminated, a flag is maintained which,
when set, means "shut the connection down when you have finished writing
all buffered data to the socket".

The problem that I have is that I cannot seem to figure out the "right"
way to close the socket at this point.

If I call shutdown()/close() immediately after the write(), the data in
the send buffer is lost, and the other side loses the last bit of data.
This is because close() dumps everything in the sending buffer that is
as yet unsent. Because the write() is non blocking, the close is issued
too early. Fair enough, this is the wrong way to do it.

Does anyone know the right way to do this?

Regards,
Graham
--

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

_______________________________________________
libev mailing list
libev@lists.schmorp.de
http://lists.schmorp.de/cgi-bin/mailman/listinfo/libev

Reply via email to