03-07-2023 01:59 PM
I am trying to connect to a socket server in python, see the attached code. I am able to write and read the necessary data, but LabVIEW throws an error code LabVIEW: (Hex 0x38) The network operation exceeded the user-specified or system time limit.
More or less I am trying to send strings to the Python server, calculate the information, and pass it back to LabView through TCP. My timeout is set to 10 seconds, and the number of bytes is 500, which is just set to hold all data that could potentially come across from the server.
Using LabVIEW 2020 if that makes any difference.
Any idea why this error keeps popping up when the data is being received? And/or how to mitigate it?
Solved! Go to Solution.
03-07-2023 02:15 PM
Are you making sure you send exactly 500 bytes back?
You don’t wire the mode input on the TCP Read so it will operate in Standard mode. You should probably make sure to append CR LF to the string and make sure the string itself doesn’t contain this sequence and then use the CRLF mode on TCP Read. There are other methods but this one would seem the most easy.
03-07-2023 02:24 PM
I am sending a variable number of bytes back, depending on what is currently needed in my software.
Changing the mode to immediate on TCP Read worked! Thank you!
03-07-2023 02:29 PM
Immediate would work as long as you make sure that the other end sends the ENTIRE response in a single write(), and it is not a huge amount that could get fragmented. Immediate basically says: return as soon as there are any bytes present to return and only wait for the timeout if no bytes at all arrive. So if your message gets fragmented, the first fragment arriving will cause the function to return with your partial data and the next read will return with the rest (or next fragment). That's usually not what you want.
03-07-2023 04:31 PM
I will most definitely keep that in mind as my software grows in size. I appreciate your assistance!