On OSX sockaddr_in needs to have sin_len set and sin_zero should be zeroed out, otherwise we cannot bind specific incoming addresses (only INADDR_ANY would work).
Note: the #ifdef APPLE might not be needed, I expect that setting sin_len and sin_zero should work fine on Linux (although is not required), but I haven't tested it.
On OSX sockaddr_in needs to have sin_len set and sin_zero should be zeroed out, otherwise we cannot bind specific incoming addresses (only INADDR_ANY would work).
Note: the #ifdef APPLE might not be needed, I expect that setting sin_len and sin_zero should work fine on Linux (although is not required), but I haven't tested it.