On Sat, Jan 5, 2019 at 1:05 AM Iñaki Baz Castillo <[email protected]> wrote: > Hi, > > Is it guaranteed that uv_xxx_bind() just fails with UV_EADDRNOTAVAIL > if the given IP cannot be bound in the host? > > To clarify, imagine that my host has IP 1.2.3.4 and TCP port 555 is in > use (no SOCK_REUSE stuff). If I do uv_tcp_bind() to 1.2.3.4:555, will > it fail with UV_EADDRINUSE and *not* with UV_EADDRNOTAVAIL, right?
There's no absolute guarantee because libuv just bubbles up the error from the operating system. Most of the time you'll see UV_EADDRINUSE but, for example, macos might return UV_EACCES if the address is protected. (I'm 90% sure the kernel's protection check comes before the already-in-use check.) I wouldn't expect to see UV_EADDRNOTAVAIL, that's the error code for when you're trying to bind to an address that isn't owned by the local machine. -- 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.
