01-24-2012 10:22 AM
Hi there !
I have a big problem with my application (executable created from LV 2011). I use an RT target (sbRIO-9612) and an eeePC.
RT code : data are acquired, they are flattened to string, and then they are sent to eeePC by TCP (I use STM library for TCP communication)
eeePC code : data are received and then they are unflattened from string
The problem is that after 6 hours of data acquisition, I got an error 116 generated by unflatten from string function : "Unflatten or byte stream read operation failed due to corrupt, unexpected, or truncated data."
Please see screenshot attached...
I plan to launch another test with a false constant wired to the input "data includes array or string size?" of "flatten to string" and "unflatten from string" function. But I really worry because I don't have a lot of ideas to fix this bug...
Thank you very much for any help.
J.
01-24-2012 10:50 AM
Six hours is a very long time. It is impossible to troubleshoot by looking at a few pictures with unknown subVIs. Could you add some debugging code that writes the actual string received to disk whenever this error occurs? This might give a clue on what's happening.
01-24-2012 11:22 AM
Thank you for your help altenbach.
OK, I have launched the test with this little VI in order to log TCP data binary string (see screenshot attached)...I'll send the log file in next post...
01-25-2012 03:01 AM
Here are 2 log files :
- TCP ERROR_ok.log : exemple of data binary string received when the "unflatten from string" function works properly
- TCP ERROR_ko.log : exemple of data binary string received when the "unflatten from string" function generates an error (error 116 if the data output is linked to graph indicator ; error 74 if the data output is not linked to graph indicator...that's strange but anyway, that's the same kind of error : corrupted data)
You will also find a VI to show you how error is generated (LV 2011). As described in the VI, the data type is as follow :
- Wfm array (64 channels)
- For each channels, 2000 points (data type : SGL)
If you have any idea...
01-25-2012 08:23 AM
I have compared both files and I noticed something (maybe it will help you to help me ! ) :
There is an 8 byte substring in each file that I find 64 times in the "good" file whereas I find it 65 times in the "bad" file (64 is logic because it corresponds to the number of channels in my waveform)...Please take a look at this VI which be more efficient than any complicated explanation.
I also have the feeling that the end of the "bad" file looks like its beginning...as if those data were corresponding to the beginning of what should have been next TCP message. Hope that's clear, sorry for my english !
01-27-2012 02:23 AM
I have done some changes and my application has now been running for 24 hours. It seems that those changes make it works (unless I post another message in next days ! 🙂 ). Maybe it will help somebody one day so I explain what I did.
1) I have developped my own "flatten to string" and "unflatten from string" functions to transfer SGL Waveform Array :
See files attached.
Then I got error 1 generated by TCP read timeout after 2 hours of data acquisition (error 1 : invalid parameter >> I didn't really understand that, I would have understood better getting a timeout error in case of deconnection for instance...)
2) I have increased TCP write timeout :
By default it was a 1 second timeout with STM library, and both "acquisition" & "TCP sender" loops periods were equal to 1 second on the RT target. "I strongly suspect it is because you code on the sending side is dropping data when it hits a timeout" said somebody in another post : I think that I had such a problem as well.
J.
03-20-2012 12:52 PM
Hello guys,please i have attached below the server and client sceen shots of a simple TCP/IP communication i am trying to do.When i run both vis i get an error message saying "LabVIEW: Unflatten or byte stream read operation failed due to corrupt, unexpected, or truncated data." Please can you look at both screen shots and let me know what i am doing wrong?Thanks
Osowoaji
03-20-2012 12:58 PM
@osowoaji wrote:
Hello guys,please i have attached below the server and client sceen shots of a simple TCP/IP communication i am trying to do.When i run both vis i get an error message saying "LabVIEW: Unflatten or byte stream read operation failed due to corrupt, unexpected, or truncated data." Please can you look at both screen shots and let me know what i am doing wrong?Thanks
Osowoaji
You are mixing data types which is probably causing at least some of your problems. In addition, you flatten some large chunk of data yet on the receive side you read only 1024. You should include the size of the data on both the sending and receiving sides. That way the receiver will know exactly how much data to read
03-20-2012 01:09 PM
Thanks Mark,so what do i do about the data types and where do i change the data size?on the flatten to string or on the TCP wite and read?I have attached the VIs maybe you can show me what you talking about.Thanks again
Osowoaji
03-20-2012 02:42 PM - edited 03-20-2012 02:44 PM
You should typecast one side or the other to match data types. As for the length modify your code to send the data length first and then send the data. Flatten to string, get the size of the string (strlen) and then send teh length as an interger then the data. On the other side read 4 bytes (the size of an integer) and typecast these 4 bytes to an integer then use that value for your next read. This way you read the exact amount of data that was sent.
Also, you should try and keep your questions related to this in a single thread. I see you have posted this question in several different threads already. I commend you for using search to get answers to your questions but you probably should have started a new thread rather than add to threads that are quite old.