Handle EINVAL errors from bind().

Resolves #1220.