mochiweb_socket_server passes both inet and inet6, which makes gen_tcp and/or ssl default to the first (IPv4 in this case). From what I can tell, there is no portable way to support both IPv4 and IPv6 on the same port (see the documentation for the ipv6_v6only option for inet). I think the closes best-effort behavior would be passing in inet6, {ipv6_v6only, true}. A better option is to force the user to pick one or the other.