[英]What happens to messages sent by sending socket but never read by receiving socket?
Suppose that I have a sender socket and receiver socket. 假设我有一个发送方套接字和接收方套接字。 The sender socket sends messages which are 1 GB in total, but the receiver socket neither read from nor close the socket. 发送方套接字发送的消息总数为1 GB,但是接收方套接字既不读取也不关闭套接字。
What happens to the 1GB of messages before either socket closes? 在任一套接字关闭之前1GB的消息会怎样? Are they sitting somewhere in OS buffer? 他们坐在OS缓冲区中的某个地方吗?
To be more specific... 更加具体...
Yes the data will be sitting in buffers in the TCP/IP stack. 是的,数据将位于TCP / IP堆栈的缓冲区中。 Though it is far far less than 1Gb. 尽管它远远小于1Gb。
Assuming you use TCP - which employs flow control to deal with such a situation, the receiver buffers will fill up. 假设您使用TCP-使用流量控制来处理这种情况,则接收器缓冲区将填满。 When the receiver buffer is full the sender will stop transmitting. 当接收器缓冲区已满时,发送器将停止发送。 The sender buffer will fill up, and when it is full, the application write/send calls will block until the receiver starts consuming the data or an error occurs 发送器缓冲区将被填满,并且当它已满时,应用程序的写/发送调用将阻塞,直到接收器开始使用数据或发生错误为止
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.