10

An application I cannot change is dropping some incoming UDP packets. I suspect that the receive buffer is overflowing. Is there a registry setting to make the default buffer larger than 8KB?

Bruno Martinez
  • 2,850
  • 2
  • 39
  • 47
  • Take a look at this [question](http://stackoverflow.com/questions/1098897/what-is-the-largest-safe-udp-packet-size-on-the-internet) and also [this one](http://stackoverflow.com/questions/900697/how-to-find-the-largest-udp-packet-i-can-send-without-fragmenting) – ja_mesa Sep 24 '13 at 17:24
  • @ja_mesa My udp packets are TS over IP and always 7*188 = 1316 bytes. I'm not concerned about fragmentation. – Bruno Martinez Sep 24 '13 at 23:00
  • Making the receive buffer larger only moves the problem a bit. Either slow down the sender or speed up the receiver. And you can't eliminate packet loss in UDP. – user207421 Sep 24 '13 at 23:54

1 Answers1

4

From this To set the default size of the Windows use the following DWORD registry keys :

[HKEY_LOCAL_MACHINE \SYSTEM \CurrentControlSet\Services\Afd\Parameters]

DefaultReceiveWindow = 10240
DefaultSendWindow = 10240
zangw
  • 43,869
  • 19
  • 177
  • 214
  • Do I need to create DefaultReceiveWindow & DefaultSendWindow under [HKEY_LOCAL_MACHINE \SYSTEM \CurrentControlSet\Services\Afd\Parameters]? As these are not available in my registry. – Tariq Jun 27 '15 at 17:32
  • You can try it, system reboot is required after changed. – zangw Jun 28 '15 at 01:17
  • Thanks. I added the values and rebooted my system. Set both values to 16384. I reached to this thread while looking for a solution to missing RTP packets during decoding RTSP stream using FFMPEG. I still see RTP packet drop from RTSP stream in the decoding process. – Tariq Jun 28 '15 at 08:10
  • There is one API in socket can get the buffer size, Sorry I cannot recall it clearly, And I am using phone now. I will give you this API once I got it – zangw Jun 28 '15 at 08:47
  • 3
    @Tariq Please try `getsockopt` with parameter `SO_SNDBUF`, you can get the socket buffer size. BTW, you can set the size of socket buffer through `setsockopt` with parameter `SO_SNDBUF`. – zangw Jun 29 '15 at 01:17
  • 2
    Bad answer. Question is about UDP. Answer is about TCP. – Jannes Jan 11 '17 at 13:14