-2

This question asks about what happens if a stream of TCP packets are not read from a socket as fast as they are received: What happens if one doesn't call POSIX's `recv` "fast enough"?

My question is however whether data that has actually been accepted and buffered by the socket has any kind of 'expiry date'? For instance if I don't call Recv for several minutes, will that data still be there waiting? And does it have any bearing whether the socket is being sent more data in the interim?

Mr. Boy
  • 60,845
  • 93
  • 320
  • 589
  • Please read [ask] and share your research. – CodeCaster Jan 22 '20 at 15:20
  • I have re-written this because that question, or at least it's answer, doesn't make it explicit – Mr. Boy Jan 22 '20 at 15:54
  • 1
    It doesn't have to make it explicit. If it isn't mentioned it doesn't happen. You don't have to explicitly mention all the things that *don't* happen. For example, the data doesn't explode either, or fly to the moon. – user207421 Jan 22 '20 at 23:00
  • You'll note the answer I accepted validates my question because it provides information NOT in the other question/answer. – Mr. Boy Jan 23 '20 at 10:04

1 Answers1

3

Data that has been received and put in a socket's inbound buffer never expires, it remains in the buffer until it is read by the application, however long that takes. Any subsequent data that is received in the interim is simply appended to the end of the buffer until it fills up, at which point new data is ignored, and in the case of TCP flow control prevents the sender from sending any further data until buffer space is freed up.

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770