12-10-2015 01:47 PM - edited 12-10-2015 01:54 PM
There are likely two possibilities:
1) The sender sends the entire package including 128 * 64 * 2 bytes
2) The sender sends only numpkts * 64 * 2 bytes at the end
In the second case you have to first read the header until you get to the numpkts variable and then calculate how much more you need to read!
Which of these two or maybe even a different format is something which the protocol description should define. If you don't have such a description the only way to find out is by trial and error and lots and lots of testing.
12-11-2015 12:11 PM
Sender sends the enire packet everytime (from Linux based PC). I also came to know that, the version number is the only the fractional value in this packet and remains constaant for all commands that my application receives in LabVIEW.
I developed the attached code (sorry- it's not clean and commented) and wish to use version number as a reference for parsing the packet.
This works fine for only first time, and there after it doesn't work. Tried playing with timeout/ loop delay, tcp read mode etc. but no success.
Don't know, what is the mistake that I am commiting.
12-15-2015 08:04 AM
Hi ,
Still in trouble.....can someone help....
12-16-2015 05:38 AM
It's difficult to say what might be the problem without being able to run it myself, but I would check your error clusters. You don't mention how it doesn't work multiple times. Does it abort after the first packet because of an error? Or does it just not receive another packet afterwards? How fast is the other side supposed to send a package? Is it supposed to send more than one package per connection request?
What errors do you see? You need to be aware that TCP/IP nodes can return errors such as timeout (56) that don't need to be treated as fatal depending on the underlaying protocol, but should rather cause your code to simply retry later once or more times. As it is now a timeout error will simply abort your whole program.
Generally you have either protocols that require first to send a command to request a particular response, or that send out one packet after connection request and then close, or spew out data every x ms, independent if the receiver is ready or not. This last one would be a very nasty protocol.
12-16-2015 08:52 AM
Let me elaborate. Very first time, it can read the packet, parse it correctly and display the parameters of the structure on GUI. Program keeps running after this, but doesn't capture the (complete?) packet afterwards. May be because I have put a check on version number, it never gets that and doesn't parse/ display the parameters. The program keeps running (though the currect code is made to stop, even if it is a timeout error- which I'll correct) and doesn't report the TCP timeout eror. Not sure, what is the reason, it can't capture the complete packate again.
The counter application keeps sending the domon (at every 1 sec.) or someother command (based on user action) and labVIEW program is supposed to respond to these commands accordingly with the appropriate data.