LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Read well structured binary data file off of UDP multicast port

I have binary UDP packet that I read (10Hz - 50Hz)from multicast IP/port and save it to file on disk (As a Recorder). The binary packets is well documented and I have it. It contains all sort of data type with multiple headers all over the packet (complex structured data). I need to write index file in ASCII format so i can use to read and display the content of this packet but I don't know how.

I also need to transmit same binary files over the multicast IP/port later on (As a Player). When I transmit the same binary file, looks like LabVIEW append some extra byte as header. because across network, other applications )non LabVIEW)complains about the format of packets.

Any help would be helpful.

Manny
0 Kudos
Message 1 of 4
(3,794 Views)
If I understand you right, in the first part of your question you want to read from a structured binary data string into LabVIEW. If you have the format, this should be easy. Most likely, it would involve chopping up the string into parts and typecasting the substrings. The exact method depends how well the data is structured. Are all the fields fixed size?

If you send something via UDP, the data is just a string. This string needs to be exactly what the other side expects. How do you convert the binary data to the string? You need to possibly change the byte order, typecast it correctly, or flatten and trim the resulting string as needed before sending.
0 Kudos
Message 2 of 4
(3,789 Views)
You understood the first issue correctly and Answer to your question "Are all the fields fixed size?" is No.
What method do you recomend? Is there any simple example around that I could look at?


And on second part of question; I need to point out that I want to transmit the "exact same binary file" that I saved with no modification to it. All byte order are Big endian form and all application across network would expect that byte order. I did "open File"->"Read File"->"Flatten to string"->"UDP write" .

This application should be able to record trafic at certain IP/port, then save it as binary file, display the content. Then I need to write another application to transmit the same saved binary file and write it back at that port at some other time.
0 Kudos
Message 3 of 4
(3,782 Views)

For the first part, I don't have an good example. Why don't you attach a simple example of your problem with a typical string as a diagram constant and a description of the format.

For the second part, just read the entire file using "read characters from file", then send the string via UDP. No need to convert the data to a string. (or use a string type for your read function).

Alternatively, you could "typecast" your data to a string instead of "flatten to string" before sending. Flatten e.g. prepends the array size, while type cast does not.

A good reference is also Application Note 154: LabVIEW Data Storage 

0 Kudos
Message 4 of 4
(3,772 Views)