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: UDPConn.LocalAddr() of ListenUDP returns "" instead of "" or "" #26346

woniuxu opened this issue Jul 12, 2018 · 0 comments


None yet
1 participant
Copy link

commented Jul 12, 2018

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

go version go1.9.2 linux/amd64

What did you do?

Server side:

ServerAddr,err := net.ResolveUDPAddr("udp",":11110")
ServerConn, err := net.ListenUDP("udp", ServerAddr)
n,addr,err := ServerConn.ReadFromUDP(buf)
fmt.Println("Received ",string(buf[0:n]), " from ",addr, " to ", ServerConn.LocalAddr())

Client side:

ServerAddr1,err := net.ResolveUDPAddr("udp", "")
Conn1, err := net.DialUDP("udp", nil, ServerAddr1)
_,err := Conn1.Write(buf)

ServerAddr2,err := net.ResolveUDPAddr("udp", "")
Conn2, err := net.DialUDP("udp", nil, ServerAddr2)
_,err := Conn1.Write(buf)

What did you expect to see?

Received  1  from  to
Received  1  from  to

What did you see instead?

Received  1  from  to
Received  1  from  to

So what shoud i do to get the "expect" result? Thanks.

@woniuxu woniuxu closed this Jul 12, 2018

@mikioh mikioh changed the title net:UDPConn.LocalAddr() of ListenUDP returns "" instead of "" or "" net: UDPConn.LocalAddr() of ListenUDP returns "" instead of "" or "" Feb 26, 2019

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