LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

TCP - Flatten, Unflatten string error

Solved!
Go to solution

You marked CrossRulz's post as a solution, yet you are showing code now that doesn't implement that solution.

 

Why not?

0 Kudos
Message 11 of 20
(697 Views)

@salauddin wrote:

Kindly help me perfect on the server side. 


It is becoming obvious that you are not thinking about what you are doing.  So let's go over the steps to read your data from the client:

1. Read 4 bytes and unflatten this string to an I32.  This is the length of the data.

2. Do another TCP/IP Read using the unflattened I32 as the number of bytes to read and unflatten this string to your cluster.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 12 of 20
(686 Views)

That was the solution for that particular issue mentioned in that respective comment.

0 Kudos
Message 13 of 20
(665 Views)

I am fairly new to LabVIEW. Could you kindly show how the unflatten can be done? Thank you in advance. Herewith, I attach both the client, server vi here. Solution in the form of Screenshot will be appreciated.

Download All
0 Kudos
Message 14 of 20
(662 Views)

@salauddin wrote:

Could you kindly show how the unflatten can be done?


I've done enough hand-holding for you.  Spend 1 minute to figure it out.  It does not have that many inputs and they are almost identical to the Flatten From String.  I understand you are new to LabVIEW, which makes it even more important you slow down and think about what you are doing and experiments to see what the functions do.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 15 of 20
(639 Views)

I have developed the unflatten string part and facing an error during execution (not before) and unable to fix it being the reason I resorted to forum. Kindly help.

0 Kudos
Message 16 of 20
(643 Views)

@salauddin wrote:

I have developed the unflatten string part and facing an error during execution (not before) and unable to fix it being the reason I resorted to forum. Kindly help.


I already told you exactly what to do three times and you still have not done it.  I am not going to do your work for you.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 17 of 20
(639 Views)

@salauddin wrote:

I have developed the unflatten string part and facing an error during execution (not before) and unable to fix it being the reason I resorted to forum. Kindly help.


If you have done what Crossrulz's has shown you, and you are still having an error, then post your latest VI as there must still be something not correctly done.

 

And please don't let this be a VI that looks just like the ones you've been posting up until now.

0 Kudos
Message 18 of 20
(629 Views)

I really feel terrible that I am unable to pick up things. Here is my updated vi.

Download All
0 Kudos
Message 19 of 20
(594 Views)

Hi salauddin,

 


@salauddin wrote:

I really feel terrible that I am unable to pick up things. Here is my updated vi.


It looks this way (after AutoCleanup):

check.png

You were suggested to "read 4 bytes, then unflatten to I32", then read the number of bytes as indicated by that I32 number.

 

You created a VI that reads 4 bytes, then get the string length of the read data (which should be 4 most of the times), wiring that number to the "byte order" input of a Unflatten function (!?) with a big coercion dot, then reading more data from TCP without indicating how many bytes to read.

 

Do you spot the difference?

Did you look at the example VIs coming with LabVIEW?

 

Btw. why do you need to open and close the TCP port so often?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 20 of 20
(590 Views)