The three ways to deal with a variable length file that I have used, are as follows....
1. Include a file header that includes the file length.
2. Have a timeout on the receiver, that after a certain length of no signal, it moves on.
3. Include an end of file sequence that would not be incorporated in the file under normal circumstances. This way the receiver constantly looks for this sequence, and stops receiving data when it finds it.
You can actually use all of these together as a kind of failsafe if data is lost.
Hope this helps,
Ron
Bookmarks