Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Only 8 192 bytes stored from UDP datagrams

Subject: Only 8 192 bytes stored from UDP datagrams

From: Martin Palmer

Date: 13 Dec, 2013 17:27:08

Message: 1 of 3

Hello everybody,

I have got a little problem which (according to Google) apparently not many people have dealt with.

I am using UDP object to download data from a measuring instrument – a simple procedure where measured values are sent as a stream of udp datagrams via LAN while appropriate DatagramReceiveFcn stores them into a binary file.

My problem is: although one datagram should contain 32 852 bytes of data (and Wireshark confirms that this amount is really being sent by the instrument), only 8 192 bytes per each datagram is saved.
That means that the loss of the data happens somewhere in Matlab. I triple-checked all properties of udp object that could have even indirect effect on this issue, I tried different values etc. but nothing helps.

Do any of you, beautiful smart people, know the solution?


Thank you very much for any advices and suggestions!

Subject: Only 8 192 bytes stored from UDP datagrams

From: Roger Stafford

Date: 13 Dec, 2013 21:46:22

Message: 2 of 3

"Martin Palmer" wrote in message <l8fg1b$5hv$1@newscl01ah.mathworks.com>...
> I am using UDP object to download data from a measuring instrument – a simple procedure where measured values are sent as a stream of udp datagrams via LAN while appropriate DatagramReceiveFcn stores them into a binary file.
> My problem is: although one datagram should contain 32 852 bytes of data (and Wireshark confirms that this amount is really being sent by the instrument), only 8 192 bytes per each datagram is saved.
- - - - - - - -
  Look at the site:

 http://www.mathworks.com/help/dsp/ref/dsp.udpreceiverclass.html

It lists among the "properties" the "ReceiveBufferSize" and states:

"Maximum size of internal buffer - Specify the size of the buffer that receives UDP packets, in bytes. The default is 8192."

  Apparently you have to specify the larger size of 32852 if you want it to apply.

Roger Stafford

Subject: Only 8 192 bytes stored from UDP datagrams

From: Martin Palmer

Date: 16 Dec, 2013 16:40:26

Message: 3 of 3

> - - - - - - - -
> Look at the site:
>
> http://www.mathworks.com/help/dsp/ref/dsp.udpreceiverclass.html
>
> It lists among the "properties" the "ReceiveBufferSize" and states:
>
> "Maximum size of internal buffer - Specify the size of the buffer that receives UDP packets, in bytes. The default is 8192."
>
> Apparently you have to specify the larger size of 32852 if you want it to apply.
>
> Roger Stafford


Thank you for your answer, it certainly looks like the right way to solve this.

But unfortunately it’s a function from DSP System Toolbox and my connection with the instrument is provided by UDP object from Instrument Control Toolbox...
So setting the property ‘ReceiveBufferSize’ of dsp.UDPReceiver actually doesn’t affect DatagramReceivedFcn of UDP object..

And yes, there could be one option – to use DSP System Toolbox instead of Instrument Control Toolbox, but that is exactly what I don’t want to do.
I have got functional application with long code based on Instrument Control Toolbox and I would switch into “Hulk mode” if I had to rewrite that whole thing just because of one nonsense with 8 192 bytes (which should be btw. solved simply by setting InputBufferSize of UDP object)... :-/

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us