sockets: Handle race condition between binds to the same port