|
tcpAddr, err := net.ResolveTCPAddr(this.IPVersion, fmt.Sprintf("%s:%d", this.IP, this.Port)) |
|
if err != nil{ |
|
logger.Fatal("ResolveTCPAddr err: ", err) |
|
return |
|
} |
|
ln, err := net.ListenTCP("tcp", tcpAddr) |
ln, err := net.Listen(this.IPVersion, fmt.Sprintf("%s:%d", this.IP, this.Port))
这样写,有什么好处?
谢谢