LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Couldn't Broadcast data of 16KB to multiple clients through UDP....:(

Solved!
Go to solution

Hi guys...!!!

My objective is to send a 2D Array of 16x100 coming from a NI-PXI hardware (Single precision float - 4 bytes each) [Total of 6400 bytes] through UDP in broadcast mode to multiple clients.

  • I've taken the simple UDP sender and receiver program and modified the sender side by taking the input as a 2D array and converting it to a string by using Array to Spreadsheet string.vi (string length comes around 14000 bytes after converting) and padding the remaining of 16KB (16384 bytes) with a "$" sign so as to  make the string length uniform of 16KB.
  • At the receiver side, the search & split string for the "$" sign and converts to the required data using spreadsheet string to array.vi and also fixed the byte size in udp read to 16384 bytes as we already know the size.

After running the Sender code in a PC-1, I'm able to receive the data in receiver code in the same PC-1. But when i run the receiver code in a different PC-2 (PC-1 & PC-2 are ofcourse in the same network), getting an Error - 56.

 

All VIs are attached.

 

Please help me guys.

Thank you

0 Kudos
Message 1 of 5
(2,271 Views)

Hi seshasai,

 

how does your VI behave when you start with smaller data size, less than 548 bytes?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 5
(2,247 Views)

Hi GerdW,

Thanks for your response.

 

My program with multiple clients is running perfectly fine up to a byte size of 1472 bytes in UDP read.vi (no.of bytes setting). And stopped working with multiple clients after 1472 bytes.

 

Thank you

0 Kudos
Message 3 of 5
(2,205 Views)
Solution
Accepted by topic author seshasai94

Hi seshasai,

 


@seshasai94 wrote:

My program with multiple clients is running perfectly fine up to a byte size of 1472 bytes in UDP read.vi (no.of bytes setting). And stopped working with multiple clients after 1472 bytes.


So that's the limitiations of your current (local) network: don't use UDP messages with length of more than 1472 bytes!

(There's a reason the UDP function default to 548 bytes for UDP messages…)

 

When you need to send more data than fit into 1472 bytes you need to split the data into several messages.

Or you switch to TCP communication which handles most of this basic stuff on its own…

 

Btw. converting 16×100 SGL values into human-readable ASCII text is not needed for UDP communication. And it even increases the bandwidth needs as it increases the message size from 6400 bytes (16×100×4) to 16384 bytes (your arbitrary 16kB limit)…

Even the padding can be made a lot easier:

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 5
(2,200 Views)

Hi GerdW,

 

Thanks for the suggestions..:)

Cheers man..!!!

 

 

0 Kudos
Message 5 of 5
(2,181 Views)