回复: Re: Should I use EV_WRITE event?

fatmck fatmck at 163.com
Thu Nov 24 14:30:11 CET 2011


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
> ------------------------------------------------------------------------
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.schmorp.de/pipermail/libev/attachments/20111124/524ba098/attachment.html>


More information about the libev mailing list