On Wed, Mar 21, 2018 at 5:41 AM, Ben Noordhuis <[email protected]> wrote:
> On Wed, Mar 21, 2018 at 1:22 AM, CM <[email protected]> wrote: > > Unfortunately I can't find a way to be notified of socket becoming > writeable > > -- is it possible with libuv? If not -- why? > > uv_poll_init() can do that. > I.e. uv_poll_t + uv_try_write will allow me to implement typical "readiness"-based logic? Is there non-blocking "uv_read_some()" function? I guess this is inefficient on Windows (compared to uv_tcp_t) -- am I correct? > If you mean uv_tcp_t/uv_pipe_t/etc. - libuv follows the Windows IOCP > model where you're notified of completion, not readiness. > I see... So, because libuv uses IOCP on Windows it has to expose "IOCP-compatible" API to end user. That means you need to commit memory upfront. Well, it isn't about committing memory upfront -- ring buffer will have it's memory preallocated. It is about being able to reuse memory as soon as possible. I.e. it would be nice to be notified that first 100kb (of my 1MB write request) is already written out and I can reuse related memory. > See https://github.com/piscisaureus/wepoll for a library that > implements the UNIX readiness model on Windows but note the > restrictions. This looks interesting. And apparently you can use it as a backend to libev. Thank you. -- Sincerely yours, Michael. -- You received this message because you are subscribed to the Google Groups "libuv" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/libuv. For more options, visit https://groups.google.com/d/optout.
