Change default socket buffer size under Windows

47,350

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
Share:
47,350
Bruno Martinez
Author by

Bruno Martinez

Updated on November 20, 2020

Comments

  • Bruno Martinez
    Bruno Martinez over 3 years

    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?

  • Tariq
    Tariq almost 9 years
    Do I need to create DefaultReceiveWindow & DefaultSendWindow under [HKEY_LOCAL_MACHINE \SYSTEM \CurrentControlSet\Services\Afd\Parameters]? As these are not available in my registry.
  • zangw
    zangw almost 9 years
    You can try it, system reboot is required after changed.
  • Tariq
    Tariq almost 9 years
    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.
  • zangw
    zangw almost 9 years
    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
    zangw almost 9 years
    @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.
  • Jannes
    Jannes over 7 years
    Bad answer. Question is about UDP. Answer is about TCP.