LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

TCP/IP Read - How do I find the number of bytes available

It appears that this is not directly possible. I am trying to get around
this by doing a tcp/ip buffered read with a very short timeout (0 or 1ms).
In theory it seems like I should be able to keep making the read call until
the exact number of bytes (4 in this case) pops out. It mostly works but
every so often hangs for some period of time and then resumes getting the 4
byte packets. Anybody have any idea what is going on?
Message 1 of 3
(3,621 Views)
The first thing I'm thinking of is that your delay is too short. Also, try to increase the packet length or use Immediate Mode (even CRLF MODE if you're transmitting text).
Another idea (if your application really needs that and you have LV / Windows) is to use MS Winsock Control (wait for DataArrival event and read BytesReceived).
Anyway, tune in your communication (packets and delays) taking in account details about your network or modem.
Good luck!
0 Kudos
Message 2 of 3
(3,621 Views)
If I change the packet length (more/less than four) , labview sends a message: "not enough memory for this operation" and the system crash.
0 Kudos
Message 3 of 3
(3,621 Views)