send() function just copy the data to the send buffer of this socket. when send() returns a positive number, it does not means the data was really send to the network. Generally, if the send buffer is empty or your data is less than the space of send buffer, send() will always return success. In my code, i always try send() first, and watch EV_WRITE after the send() returns an EAGAIN error.

于 2011年11月07日 17:11, 钱晓明 写道:
Thanks for the reply! I just read the source code of Redis, which has a IO event mechanism similar to libev. I find that it install write event when there is data to send back and remove it after all data sent. In callback function, Redis only send a fixed number of bytes to client if the reply data is too long, then return from this function without deleting write event. I think this is situation C.
2011-11-07
------------------------------------------------------------------------
Kyle Qian
------------------------------------------------------------------------


_______________________________________________
libev mailing list
[email protected]
http://lists.schmorp.de/cgi-bin/mailman/listinfo/libev

Reply via email to