How to change the UDP receive buffer size in udpport and what is its max value?

40 vues (au cours des 30 derniers jours)
海 林
海 林 le 26 Mai 2023
Commenté : 海 林 le 1 Juin 2023
I am using the matlab to receive the data from a FPGA using UDP. But I came with some packages loss problem.
The data stream is under a burst mode. A burst speed could be over 600Mbits/s and the size is about 48MBytes (1024bytes/package and 49152 packages). I found the problem comes frome the receive buffer size of udp sockets. And I can't find the option to change it.
I tried the python which can modify the SO_RCVBUF to meet my requirements.
Also, I found the 'dsp.UDPReceiver' object can modify the receive buffer size by 'ReceiveBufferSize', and the max size is 67108864. It did buffer all the burst data.
The old function udp() can also modify the buffer size by 'InputBufferSize'. But it still loss packages when i set a value over 48M.
Now, scripts are implemented using udpport. I want to know if I can modified the receive buffer size of udpport() and its max value. So if the buffersize of udpport() can be solved, we don't need to turn it into 'dsp.UDPReceiver'.

Réponses (1)

Meet
Meet le 31 Mai 2023
Hi,
To modify the receive buffer size of ‘udpport()’ in MATLAB, you can use the ‘set’ method.
Example :
bufferSize = 16384; % modify the buffer size (in bytes)
set(u, 'InputBufferSize', bufferSize);
where ‘u’ is the UDP object returned by the udpport() function, and ‘bufferSize’ is the desired receive buffer size in bytes. The above example will set the receive buffer size of the UDP object to 16384 bytes.
Regarding the max value of the receive buffer size, it depends on the operating system and network hardware limitations.
For more details on the ‘set’ function , please refer Configure or display instrument object properties - MATLAB set (mathworks.com).
Hope this helps!
  1 commentaire
海 林
海 林 le 1 Juin 2023
Hi
Thank you for your answer but there is no 'InputBufferSize' property in the udpport() object, so there will be error when using the 'set' function. It does be a property of the udp() but not udpport(). BTW, My matlab version is 2021b.
Best

Connectez-vous pour commenter.

Tags

Produits


Version

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by