06-02-2020 06:05 PM
Hi,
I created a simple tcp sender and receiver to test that I can send and receive tcp data before adding it in my actual code.
I'm using ports on my computer to send and receive data but I'm running into Error 74 on the listener side. How can I resolve this?
I have attached the code.
Thanks
Solved! Go to Solution.
06-02-2020 07:43 PM - edited 06-02-2020 07:59 PM
You are trying to unflatten the data in a way that is completely different than the flattening.
Why?
Also, you didn't wire in any bytes to read in the TCP Read. So it defaults to 0. You can unflatten nothing.
Look at LabVIEW examples for TCP sender and receiver. You need to determine how many are being send and wire that into the TCP Read.
06-03-2020 07:20 AM
Thanks RavensFan for pointing out those mistakes. I will make the changes.
06-03-2020 07:40 AM
@RavensFan wrote:Look at LabVIEW examples for TCP sender and receiver. You need to determine how many are being send and wire that into the TCP Read.
Personally, I am a big fan of the STM library, which abstracts this away for you.
06-03-2020 09:46 AM
Hi RavensFan,
I've made changes to my sample code however the data received on the listener side isn't being parsed correctly. Each element in the data cluster is updated with all values sent instead of one specific data element. You can run the code and see it. I'd like to work with the native labview tcp functions for now but will check the STM library later. Can you take another look at the code to see what I'm doing wrong? I've attached the modified code.
Thanks
06-03-2020 10:48 AM
Your receiver first needs to read the 4 bytes to get the message size, convert that into an I32, read that number of bytes, and then convert the read data into the cluster. Again, the STM library takes care of this for you.
06-03-2020 11:12 AM
Thank you crossrulz. My sample code is now working correctly. I will check out the STM library. Thanks again for your help!