Change default socket buffer size under Windows [closed]
Asked Answered
C

1

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?

Coz answered 24/9, 2013 at 15:28 Comment(3)
Take a look at this question and also this oneAnasarca
@Anasarca My udp packets are TS over IP and always 7*188 = 1316 bytes. I'm not concerned about fragmentation.Coz
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.Fabiola
L
5

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
Leporide answered 20/11, 2013 at 3:6 Comment(7)
Do I need to create DefaultReceiveWindow & DefaultSendWindow under [HKEY_LOCAL_MACHINE \SYSTEM \CurrentControlSet\Services\Afd\Parameters]? As these are not available in my registry.Attenuator
You can try it, system reboot is required after changed.Leporide
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.Attenuator
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 itLeporide
@Attenuator 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.Leporide
Bad answer. Question is about UDP. Answer is about TCP.Bozeman
@Bozeman - zangw's response is technically correct. Although it mentions TCPIP in the document, it covers UDP as well. Please refer to the official Microsoft documentation available here: learn.microsoft.com/en-us/previous-versions//…Ultan

© 2022 - 2024 — McMap. All rights reserved.