Fixed automatic port allocation in bind_sockets.

bind_sockets should use the same port on IPv4 and IPv6 if port=None.