On Fri, 12 Jul 2013 11:27:45 -0700 Kyle Lemons <
kev...@google.com>
wrote:
> On Fri, Jul 12, 2013 at 11:08 AM, Louis Opter <
kale...@kalessin.fr>
> wrote:
>
> > On Fri, 12 Jul 2013 14:22:28 +1000 Dave Cheney <
da...@cheney.net>
> > wrote:
> >
> > > I think it works like this
> > >
> > > If you want ipv4, net.Listen("tcp4", ":0")
> > > If you want ipv6, use tcp6
> > > If you want to roll the dice and let someone else choose, use
> > > straight "tcp"
> >
> > I don't want to roll a dice, I'm looking for the way to use both
> > ipv4 and ipv6 on the same net.Conn (same socket).
> >
>
> Do you mean the same net.Listener? A connected socket will be either
> ipv4 or ipv6.
My bad, I meant net.Listener. An inet socket will be either IPv4 or IPv6
but (at least on Linux) an IPv6 socket can be configured to also accept
IPv4 connections (and the address will appear as an IPv4 mapped IPv6
address [1]).
> To start with, I've listened on "localhost" and seen it listening on
> both before, so what OS are you on? Have you tried listening on both
> tcp4 127.0.0.1 and tcp6 ::0?
I'm really concerned about Linux here. And the point is to not listen
on both tcp4 and tcp6 but use the same net.Listener (so same socket)
for both. This is what I'm trying to achieve.
[1]
https://en.wikipedia.org/wiki/Ipv6#IPv4-mapped_IPv6_addresses
PS: Dave, sorry I meant Dave and not David, please blame my four
different friends called David.
--
Louis Opter