3 ms·
> An unknown address family will return a '0'. In this particular case, returning 0 doesn't necessarily indicate failure. Binding a socket to port 0 means you'
by erkl 12y ago
> An unknown address family will return a '0'.
In this particular case, returning 0 doesn't necessarily indicate failure. Binding a socket to port 0 means you're asking the operating system to pick an available port for you, which one might argue is a reasonably safe default for unknown address families.
- jacquesm 12y agoNo, there is no 'default' at play here. If you don't know what address family is in use then you should simply abort rather than to let the end user of your product guess that the address family code is the culprit. Let it crash, as close as possible to the point of origin of a problem is a very good principle.