go使用TCP连接服务端错误

自己写了一个跑在Linux服务端的go程序,从客户端连接时提示:No connection could be made because the target machine actively refused it.
然后关闭防火墙该,双向ping都能同,依然心灰意冷。但作为程序小白,百度了很多都无用,看了go的文档,在示例显示监听端口的代码net.Listen("tcp", ":8080"),我以前的监听代码net.Listen("tcp", "127.0.0.1:8081"),我把IP去掉换成了现在这个代码net.Listen("tcp", ":8081"),居然能通了。。。。。。。此处省略无数的。。。。。,这证明得多多学习

猜你喜欢

转载自blog.51cto.com/3316448/2388943