LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

TCP Read Fail

Solved!
Go to solution

I am starting with a very basic program to test TCP write/read functionality before I make it more complicated.  It appears that I can send commands OK to my DUT (device under test) , I am having problems with reading back responses from the device.  Using Wireshark, I can see that the 3-bytes are actually received by the host computer (0x02 0x06 0x03 Acknowledge) , so firewall is not an issue, but they are not making it into labview read field.  I have tried the different modes for read (standard, buffered, immediate) but none of these modes bear any fruit.  Any ideas on how to fix this issue or debug this issue would be appreciated. 

   

Download All
0 Kudos
Message 1 of 22
(2,250 Views)

You should be using the "standard" mode, as that will wait up to the timeout for the number of bytes you specify.


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 2 of 22
(2,232 Views)

Unfortunately, standard mode does not work.

0 Kudos
Message 3 of 22
(2,211 Views)

@Froboz wrote:

Using Wireshark, I can see that the 3-bytes are actually received by the host computer (0x02 0x06 0x03 Acknowledge) , so firewall is not an issue


Maybe a software firewall? I don't know at what level they operate compared to Wireshark, but it certainly seems possible that Wireshark would be able to see packets which a software firewall then prevents another application from seeing.


___________________
Try to take over the world!
0 Kudos
Message 4 of 22
(2,173 Views)

Labview appears to be allowed in all cases:

 

Froboz_0-1660761469670.png

but would there be a different layer I could be missing that would prevent data from coming through?

0 Kudos
Message 5 of 22
(2,150 Views)

An Error 66 accompanies the failed read.   This is what I came across regarding Error 66.

Froboz_0-1660763007591.png

https://lavag.org/topic/13678-tcpip-error-code-66/

 

In the case of this individual, they get this error sporadically.  In my case, I get it all the time when I attempt a read.

0 Kudos
Message 6 of 22
(2,144 Views)

To further debug the problem, it could be useful to bisect the problem. In the example library, there is a TCP Host/Listener example - can you get that to work? What if you create the socket outside of LabVIEW, e.g. from powershell (https://stackoverflow.com/questions/29759854/how-to-connect-to-tcp-socket-with-powershell-to-send-an...)? Can you use powershell to send packets to LabVIEW or receive packets from the device?

0 Kudos
Message 7 of 22
(2,122 Views)

No, don't use power shell to create the connection and pass data to LabVIEW via that. You have a very clear error which indicates what is happening. Error 66 means the other side of the connection closed the connection. Why is the device you are connecting to closing the connection? In terms of your application you would need to handle this error and open a new connection to the device.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 8 of 22
(2,098 Views)

The issue with just using the Labview listener is that the code needs to be compatible with the device I am testing.   The device requires a command to be sent to it.  In this case the device will respond with 3-bytes which corresponds to an acknowledge.   

 

I did download VS Code with Powershell and tried running a modified version of the link you sent.  It's complaining the connected host has failed to respond 192.168.100.118:9760.  Address and port look right.  Something else to try to figure out.

0 Kudos
Message 9 of 22
(2,078 Views)

Trust me, LabVIEW will be more than capable of communicating with that device. You do need to know and implement the device protocol correctly.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 10 of 22
(2,074 Views)