On Fri, 15 Mar 2019 at 13:31, Ben Noordhuis <[email protected]> wrote:
> > May I know why uv_tcp_bind did not fail? This is, why is it designed that 
> > way?
>
> That's not a libuv design, it's because some operating systems don't
> commit the port until it's actually used - i.e., until it listens or
> connects to somewhere.

Clear.

> The documentation contains a small lie: uv_tcp_bind() defers
> EADDRINUSE error reporting to uv_listen() and uv_tcp_connect().
> Corrected in https://github.com/libuv/libuv/pull/2218.

Ok.

So in order to "fix" my use case problem (I cannot set the definitive
uv_connection_cb in the C file in which I call to uv_tcp_bind(), I see
two approaches:

1) Calling uv_listen() twice (with a different uv_connection_cb). I do
it currently in the same loop iteration and it works.

2) "Manually" change the uv_connection_cb in the uv_handle struct.
This is not public API AFAIK.

Which is the best approach? Is there anyone better?


-- 
Iñaki Baz Castillo
<[email protected]>

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

Reply via email to