I've encountered some strange behaviour when attempting to send strings over a TCP connection.
Opening the TCP connection works fine (confirmed on the other device), but whenever I attempt to send a string I don't get the response I expect from the other device. When troubleshooting I found that the other device doesn't appear to be recognising that anything was sent by my VI.
More oddly, when I close the TCP connection from the VI, the other device suddenly 'gets' the string I sent, sends the response it should be sending, and then closes the connection on its end. Obviously, I don't receive the response on the VI end as it has already closed the connection. It feels like my VI is 'caching' the stuff I tell it to send and only actually sending it when it closes the connection. Now that I think about it, it may be that it only sends the last string I tried to send at the point of closing the connection, but I would need to check that when I'm in front of the device again to be sure.
I've gone as far as adding code to close the TCP connection immediately after sending the string, which has the same effect - but this hack clearly isn't going to cut it as I can't receive the device's responses. (Repeatedly opening and closing a TCP connection feels like bad practice anyway - but I'm no expert in this field.)
Does anyone have any input on this? Have I simply made a dumb mistake, or misunderstood the TCP protocol / the use of Labview's TCP VIs?
I haven't got a huge amount of experience with Labview and I'm early in my engineering career, so I don't want to go down the thought process of whether the client's device is misbehaving before being very sure that I haven't made mistakes on my end!
The VI I used to test the connection with the device I'm communicating with is attached (forgive the mess and poor structure, I put it together quickly to test the interfacing when my client dropped off their device).