02-01-2018 02:20 AM
Good Morning,
I expose my problem:
I transmit a string beetwen TCP (TCP Write), but when I read this string (TCP Read) it is not always in the same order as it was sent, sometimes yes, sometimes not, how can I read the string exactly? in the same order that was sent?
Thank you. A greeting
02-01-2018 03:17 AM
02-01-2018 03:21 AM
You need to explain in more detail what you are doing. TCP is a stream based protocol and one of its guarantees is that the data arrives in the same order as it was sent. If that does not appear so you have probably a race condition in your sender where you try to send from different locations in parallel through the same connection refnum and while you think you enforce a specific order you don't since LabVIEW is happily executing code that has no data flow dependency in parallel with each other and then it is pure randomness which function is scheduled earlier. You may think that if you single step through the code there only is always the one code function executing but that is because LabVIEW has to sequentially highlight the functions since humans are pretty bad to interpret multiple things happening in parallel. When you disable single stepping LabVIEW executes the code again with full speed and not necessarily in the same order as what you saw in single step mode debugging.
02-01-2018 03:25 AM
That's not normal behaviour. Must be something you're doing.
Do you send one string (e.g. one send)? Or
Do you send the string from multiple parallel loops?
Some code would help.
02-01-2018 03:52 AM
Hello,
firstly thanks to answer.
I'm attaching a image of program, I'm communicating my computer with a sb-rio
Thanks.
02-01-2018 03:59 AM
02-01-2018 04:09 AM
can it be that you still have something in the buffer from "before"?
so you get the "0" from an earlier send as first char of your 4?
02-01-2018 04:24 AM
The string is composed from 2W00 or 2W02 or 2W10 or 2W11
This is 4 byte , not?
02-01-2018 04:25 AM
I thought so , but I don't know how can i check this.
Do you know?
02-01-2018 04:32 AM
Or how i can clean the buffer?