LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Send double type using ZeroMQ

Solved!
Go to solution

Dear all,

I would like to ask about the ZeroMQ library. I am currently using it to transfer numbers as a "string" type but I can't find how to send it as integer or double. Since there is a huge amount of data in my application, using double data type would speed it up rapidly.

 

I could find only the solution for c++ here but no examples for LabVIEW.

 

 

0 Kudos
Message 1 of 5
(4,261 Views)
Solution
Accepted by topic author Thomas444

There are many ways to transfer numbers as strings, the most obvious would be to flatten or typecast DBLs or arrays of DBLs to a string and reverse on the other end. This is the most efficient, because there is no loss in bits and everything gets transferred verbatim, 8 bytes/DBL.

 

You would only get a slowdown if you would do silly things, such as formatting the DBLs into human readable strings and scanning them back later on the other end. This is lossy and inefficient.

 

(As you can see, we need to guess because you are not showing us any code explaining what you currently do and what you think is inefficient.)

Message 2 of 5
(4,260 Views)

That function was a custom method added to that users socket class - I don't believe the protocol supports sending other data types - you would need to translate your DBL to a string somehow. Are you writing the code for both applications? Note if you aren't talking to another LabVIEW application, the way numbers are represented as strings will not be the same.

 

Message 3 of 5
(4,232 Views)

Thank you guys for your answers,

 

so I was sending the numbers as a human-readable string (brunch B) before, what I consider to be inefficient. After that I flattened the numbers into the string according to your advice (brunch A). First, I tested this Request-Reply communication on my computer locally. There was no problem reading it on the Request side and volume of the data was reduced. There are both files in the attachment.

ZMQ replyZMQ reply

After testing it locally, I was able to communicate also with PHP Request application. Critical is to set 'prepend array or string size?' to False and synchronize the endians of both applications.

 

I would accept your solutions, if I understood your advice well.

Download All
0 Kudos
Message 4 of 5
(4,213 Views)

@Thomas444 wrote:

Critical is to set 'prepend array or string size?' to False and synchronize the endians of both applications.

 


If you want big endian and prepend=false, you could just use typecast.

0 Kudos
Message 5 of 5
(4,167 Views)