12-02-2013 08:03 PM
We want to communicate with a server from CRIO-9082 using TCP/IP. The server
can only send and receive integers and I know the TCP functions in LabVIEW can
only send and receive strings. Is there a way to solve this problem? We don't
have control over the server. Thanks
12-02-2013 10:21 PM
Hi yaoyuc,
May I ask if you can provide a code which you have created on this project? May I know the setup of your project? Is the server using LabVIEW as well? What is your LabVIEW version and what do you mean by you have no control over the server?
If you want to send integers using TCP/IP functions, I suggest that you should convert that integer into string and at your server side (if it uses LabVIEW), you need to revert the steing back to integer. To do this, you'll need to add some functions before the TCP read and TCP write functions.
Before the TCP write, you'll need to convert integer into string by using Format into String function (Functions Pallate >> String).
Before the TCP read, you'll need to convert that string into integer by using Scan from String function (Functions Pallate >> String)
I suggest that you should use Quick help (Ctrl+H).
Hope it helps
Warmest regards,
Lennard.C
12-02-2013 10:38 PM
Hi,
TCP does not know the difference between strings and integers. It just sends bytes. LabVIEW's TCP Write.vi interprets the input string as an array of bytes.
Use Flatten to String to reinterpret your integers as bytes, then pass the "byte string" into TCP Write.vi. Make sure you:
If you want to see the bytes in a string, right-click the string constant/control/indicator and select "Hex Display"