本文介绍了为什么在接收端继续接收'无限',当我使用&QUOT插座;控制C"关闭上发送对等体的插座的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我对Socket编程,我知道这是一个坏习惯使用Ctrl-C组合关闭插座,但一个新手,为什么在接收端插座不断地接受'无限'后,我用Ctrl-C组合关闭发送过程?不应该在发送方套接字控制C后关闭退出的过程?谢谢!
解决方案
That closes the entire process, not just a socket.
At a guess, which is all that is possible without seeing the code you should have posted in your question, you are ignoring errors and end-of-stream when calling recv().
It is. The whole process is 'closed', including all its resources.
As regards the receiving socket, it is up to you to detect the conditions under which it should be close, and close it.
这篇关于为什么在接收端继续接收'无限',当我使用&QUOT插座;控制C"关闭上发送对等体的插座的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!