‎05-18-2010 08:32 AM
Solved! Go to Solution.
‎05-18-2010 08:37 AM
Have you used a network sniffer to check the raw TCP data? TCP should prevent any data loss "en route"...
Br, Mike5
‎05-18-2010 08:59 AM
As Miha said, a TCP connection should not lose any data (not silently, at least), but from your description I understand that you can't really control the IP implementation.
Since this is a stream, what you can probably do is simply read N bytes each time (let's say 200) and simply have a buffer of the last N*X bytes. Then, you can check the data in that buffer. If you're missing the LLLL bytes for some reason (and you don't mind losing the entire packet of data), you can just look for the end of the message, make sure what follows it is the correct beginning of the next message and just continue from there.
‎05-18-2010 09:00 AM
Jim,
Without seeing how your packet loop is currently structured it is hard to suggest changes. I would keep all the received data in a shift register until a complete, valid packet was present. Then extract the valid packet string and pass it to the parser. Keep any bytes after "END" to begin the next packet. Discard any data before the valid packet as invalid (or save it for a human user to interpret if the value is high).
Lynn
‎05-18-2010 09:04 AM
The error comes when the LLLL data is lost, so the TCP Client reads four bytes (probably S,T,A,and R) as LLLL, which convert to a number that is very large, then reads LLLL bytes (maybe 50M) but this read fails because there is not enough memory to read that much data.
Hi!
First a question: why not putting LLLL after a delimiter? (Or at least checking that after LLLL there is START...).
It'll be useful to check the part of your code where you read the TCP stream...
p.s. What about a trip on the ISS as a prize for an "accepted solution"??
‎05-18-2010 10:43 AM
I would look at configuring the Nagle Algorithm and/or Delayed ACK options on your remote and earth-bound stations.
Do LabVIEW TCP Functions Use the Nagle Algorithm?
TCP Performance problems caused by interaction between Nagle's Algorithm and Delayed ACK
Applications such as networked multiplayer video games expect that actions in the game are sent immediately, while the algorithm purposefully delays transmission, increasing bandwidth at the expense of latency. For this reason applications with low-bandwidth time-sensitive transmissions typically use TCP_NODELAY to bypass the Nagle delay.
‎05-18-2010 06:36 PM