ListenTCP announces on the TCP address laddr and returns a TCP
listener. Net must be "tcp", "tcp4", or "tcp6".
While the meaning of tcp4 and tcp6 is obvious, it is not clear at all
what are the semantics of tcp. Testing on Linux, it seems that, if
net.ipv6.bindv6only = 0 (the old default value on most Linux-based
OS), it has the expected meaning (both v4 and v6, which is very
convenient) but, if net.ipv6.bindv6only = 1 (the default on recent
Linux-based OS), then tcp means tcp6 only :-(
It's supposed to mean what you see with bindv6only = 0.
What distributions set bindv6only = 1?
What a crock: the one thing in sockets that was actually
a tiny bit generic, and it's gone.
The thing to do is probably detect the broken bindv6only
setting and then set preferIPv4 = true when it's set.
This has the unfortunate property that listening to ":1234"
would only listen to IPv4 port 1234, not IPv6 addresses too.
But hey, if the kernel wants to break my program,
who am I to argue?
Russ