Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net: Listen("tcp", "0.0.0.0:11111") listens on [::]:11111 #7411

Closed
mattrco opened this issue Feb 25, 2014 · 4 comments

Comments

Projects
None yet
3 participants
@mattrco
Copy link

commented Feb 25, 2014

http://play.golang.org/p/yjqyCAEMyR

What is the expected output?

I expect all examples to listen on an IPv4 address. On the playground this is the case.

What do you see instead?

net.Listen("tcp", "0.0.0.0:11111") listens on [::]:11111 on my
system.

The full output is:
2014/02/25 19:59:14 0.0.0.0:11111
2014/02/25 19:59:14 [::]:11112
2014/02/25 19:59:14 127.0.0.1:11113
2014/02/25 19:59:14 127.0.0.1:11114

Which operating system are you using?

Ubuntu 12.04, 3.8.0-36-generic

Which version are you using?  (run 'go version' or 'gccgo --version')

go version go1.2 linux/amd64

The only reason the examples use different ports is because the playground doesn't
Close() quickly enough for the program to succeed (it works when I Close() locally).
From testing, I don't think port number makes a difference to the behaviour.

Admittedly the workaround is trivial, but I thought this worth reporting anyway.
@mikioh

This comment has been minimized.

Copy link
Contributor

commented Feb 26, 2014

Comment 1:

Thanks for the report but that's intentional. In the net package, a dumb and small
bump-in-api feature translates so, because we thought that it's ridiculous we must use
IPv6 textual address representation when we want to run tcp over dual IP stack on the
passive-open side. For now any of the following enables "tcp over dual IP stack on the
passive-open side" if possible.
tcp + ":port"
tcp + "0.0.0.0:port"
tcp + "[::]:port"

Status changed to WorkingAsIntended.

@mikioh

This comment has been minimized.

Copy link
Contributor

commented Feb 26, 2014

Comment 2:

> when we want to run tcp over...
For a "wlidcard" listen, of course.
@mattrco

This comment has been minimized.

Copy link
Author

commented Feb 26, 2014

Comment 3:

Thanks, that clears things up. Perhaps it's worth mentioning in the docs.
@mikioh

This comment has been minimized.

Copy link
Contributor

commented Feb 26, 2014

Comment 4:

Status changed to Duplicate.

Merged into issue #5632.

@mattrco mattrco added the duplicate label Feb 26, 2014

@golang golang locked and limited conversation to collaborators Jun 25, 2016

This issue was closed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.