[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[Libevent-users] EV_WRITE - Wait for a socket or FD to become writeable.



Hi all,

I have a question about EV_WRITE event as to when does it's callback function invoked?

Is it that when someone first executes write on an fd associated with EV_WRITE event?

Or when libevent detects that application can now write to fd without getting errors?

For EV_READ it is easy to understand that it's callback is invoked when data is available for read on fd but not clear about EV_WRITE.

Here is what I am trying to do -

I am trying to write asynchronous send/recv application; in which I will read data on connected sockets asynchronously using "EV_READ's callback.

For send however, I will enqueue the data to be sent in my own queue(application will write data to this buffer) and I will flush the buffer in EV_WRITE callback.

Now if I get the error EAGAIN in send operation in callback of EV_WRITE, I will simply return  and on next invocation of EV_WRITE's callback I will start flushing my buffer again.

Thanks,
Parvez