On Fri, Mar 15, 2019 at 3:43 AM Iñaki Baz Castillo <i...@aliax.net> wrote: > According to the uv_tcp_bind doc: > > > When the port is already taken, you can expect to see an UV_EADDRINUSE > > error from either uv_tcp_bind(), uv_listen() or uv_tcp_connect(). That is, > > a successful call to this function does not guarantee that the call to > > uv_listen() or uv_tcp_connect() will succeed as well. > > Indeed I confirm that, at least in Linux, uv_tcp_bind may succeed > while the next call to uv_listen may fail with UV_EADDRINUSE. > > 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. 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. -- 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 libuv+unsubscr...@googlegroups.com. To post to this group, send email to libuv@googlegroups.com. Visit this group at https://groups.google.com/group/libuv. For more options, visit https://groups.google.com/d/optout.