Skip to content

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

@mattrco

Description

@mattrco
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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions