Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
2.3k views
in Technique[技术] by (71.8m points)

socket编程代码层面发送数据成功,但实际上tcp没发送数据

语言用的Golang,socket项目,发送数据给客户端,没有报任何错,用的也是Go官方的net包,代码如下

_, err := c.Write(data)
if err != nil {
     fmt.Println("发送数据失败 ", err)
     break
}

但是客户端并没有收到我发送的数据,tcpdump抓包后到wireshark上看也没有看到发送的tcp包

连接量也不大,目前测试阶段也就7,8个设备,设备会定时通过tcp上报数据,我能接收到

请问这是什么原因,遇到过类似问题的麻烦说说你的解决方法,或者告诉我下该往哪方面查找问题,谢谢大家~


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

你需要确认这行代码是否执行了。


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...