Fixes for ipv4 and ipv6 sockets

The fixes here allow connections from both ipv6 and ipv4 machines.