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
Closed

net: ListenTCP with nil laddr #4190

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

Comments

@petar
Copy link
Contributor

petar 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
Copy link
Contributor

mikioh 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
Copy link
Contributor

mikioh commented Oct 5, 2012

Comment 2:

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

Status changed to Accepted.

@rsc
Copy link
Contributor

rsc commented Oct 6, 2012

Comment 3:

Labels changed: added go1.1.

@mikioh
Copy link
Contributor

mikioh commented Nov 12, 2012

Comment 4:

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

Status changed to Started.

@mikioh
Copy link
Contributor

mikioh commented Nov 13, 2012

Comment 5:

This issue was closed by revision 677c6e6.

Status changed to Fixed.

@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.
Projects
None yet
Development

No branches or pull requests

4 participants