1

In my application, I am trying to send and receive datagrams to different servers as quickly as possible. I noticed that increasing the sending rate is greatly lowering the percentage of responses I receive for a given # of sends. I believe one cause could be recvfrom()'s queue is filling faster than I can call the function to read the packets, reaching the end and dropping a a lot of packets. Is there a way I can check how full the receive buffer is for a socket?

This is on Windows, not Linux, and I would prefer a programmatic approach.

user207421
  • 305,947
  • 44
  • 307
  • 483
Joe Johnson
  • 177
  • 1
  • 7
  • 1
    Do you mean that from the sending side you want to check how full is the buffer on the receiving side? – John Zwinck Jan 27 '17 at 04:57
  • No, I want to be able to see how many bytes are in the buffer before calling recvfrom() – Joe Johnson Jan 27 '17 at 05:01
  • 1
    You mean like this? http://stackoverflow.com/questions/2289830/how-to-monitor-linux-udp-buffer-available-space – John Zwinck Jan 27 '17 at 05:03
  • Possible duplicate of [How to monitor Linux UDP buffer available space?](http://stackoverflow.com/questions/2289830/how-to-monitor-linux-udp-buffer-available-space) – jfly Jan 27 '17 at 05:21
  • 1
    Assume that there is a mechanism that would tell you how many bytes are currently in the receive buffer. Once you had that mechanism, what would you do with it? It seems to me that regardless of what the current value is, your only choice will be to read packets out of the buffer as quickly as possible. – Jeremy Friesner Jan 27 '17 at 18:39
  • Or increase the buffer size so fewer packets have to be dropped. – Remy Lebeau Jan 28 '17 at 00:19

0 Answers0