Skip to content

Commit

Permalink
修正net.ListenTCP()的参数 (unknwon#680)
Browse files Browse the repository at this point in the history
net.ListenTCP() 的参数为(string, *TCPAddr)
  • Loading branch information
hingbong authored and unknwon committed Jul 16, 2019
1 parent 0584651 commit 9865ae6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion eBook/15.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ func main() {
func initServer(hostAndPort string) *net.TCPListener {
serverAddr, err := net.ResolveTCPAddr("tcp", hostAndPort)
checkError(err, "Resolving address:port failed: '"+hostAndPort+"'")
listener, err := net.ListenTCP("tcp", serverAddr.String())
listener, err := net.ListenTCP("tcp", serverAddr)
checkError(err, "ListenTCP: ")
println("Listening to: ", listener.Addr().String())
return listener
Expand Down

0 comments on commit 9865ae6

Please sign in to comment.