From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
01-13-2020 07:02 AM - edited 01-13-2020 07:23 AM
Hi,
I have developed code using TCP Protocol to pass a string and the status of a Boolean signal. I am facing an issue and unable to fix it. Any help will be appreciated. Attaching both the client and server vi(error faced)* here. Thank you.
*error faced in tcpServerTest.vi (attached)
Solved! Go to Solution.
01-13-2020 07:14 AM
You are only reading 2 bytes. Your string will contain at least 4 bytes since the length is prepended as a U32. A common thing to do here is to get the length of your flattened string and transmit that first. Then the client reads 4 bytes (I32) to get the length and then read that number of bytes. You can then use the Unflatten From String on your read data to get your cluster value.
01-13-2020 07:37 AM - edited 01-13-2020 08:12 AM
While trying to implement based on your advise, I am doing something wrong here. Could you throw some light on the same? Help in the form of screenshot or vi.
01-13-2020 08:59 AM
I further improved the code like this. Kindly look at both the client and server vis and help me perfect the code. (I guess changes needs to be done on the server side)
01-13-2020 09:13 AM - edited 01-13-2020 09:14 AM
@salauddin wrote:
While trying to implement based on your advise, I am doing something wrong here. Could you throw some light on the same? Help in the form of screenshot or vi.
On the client side, you first read 4 bytes to get the length. Unflatten that value to an I32 and wire that directly to the next TCP Read to read the data.
01-13-2020 09:30 AM
I am trying to implement this but unable to locate this bundling terminal in my palette (I am fairly new to LabVIEW).
Kindly mention the name of the bundle functionality mentioned in your code(find screenshot below) so it will be easy for me to locate.
01-13-2020 09:32 AM
01-13-2020 09:37 AM
@GerdW wrote:
Hi salauddin,
hint: that "bundling terminal" is getting two strings as input and gives one string as output.
Have you looked into the string functions palette?
You could even say it stiches, links or concatenate the strings. 🙂
/Y
01-13-2020 09:51 AM
Dear GerdW, thanks a lot that I have perfected the code on the client end. Kindly help me perfect the code on the server end as well. Thank you so much in advance.
01-13-2020 10:11 AM
Kindly help me perfect on the server side.