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: ListenTCP with nil laddr #4190

Closed
petar opened this issue Oct 3, 2012 · 5 comments

Comments

Projects
None yet
4 participants
@petar
Copy link
Contributor

commented Oct 3, 2012

darwin
amd64
e4dff4e4278f tip

This code prints: 0. I would expect it to return the port it found for that listener.


package main
import "net"
func main() {
    l, err := net.ListenTCP("tcp", nil)
    if err != nil {
        panic(err)
    }
    println(l.Addr().(*net.TCPAddr).Port)
}
@mikioh

This comment has been minimized.

Copy link
Contributor

commented Oct 4, 2012

Comment 1:

I guess that accepting nil as arg is incorrect because
ListenUDP and ListenIP reject it. What do you think?
Please refer issue #3847 too.
@mikioh

This comment has been minimized.

Copy link
Contributor

commented Oct 5, 2012

Comment 2:

https://golang.org/cl/6525048/

Status changed to Accepted.

@rsc

This comment has been minimized.

Copy link
Contributor

commented Oct 6, 2012

Comment 3:

Labels changed: added go1.1.

@mikioh

This comment has been minimized.

Copy link
Contributor

commented Nov 12, 2012

Comment 4:

https://golang.org/cl/6525048/

Status changed to Started.

@mikioh

This comment has been minimized.

Copy link
Contributor

commented Nov 13, 2012

Comment 5:

This issue was closed by revision 677c6e6.

Status changed to Fixed.

@petar petar added fixed labels Nov 13, 2012

@rsc rsc added this to the Go1.1 milestone Apr 14, 2015

@rsc rsc removed the go1.1 label Apr 14, 2015

@golang golang locked and limited conversation to collaborators Jun 24, 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.