| I've had similar problems with reading streams from COM1, you cannot
tell when the end-of-file has been received.
LOF() will tell you how many characters are in the buffer waiting to be
processed, but if this is zero it might simply be due to a time-lag on
the senders side (ie: you have processed all the characters sent to you
so far, but more may follow at any moment).
If the sender process does not send a special character sequence to
tell you that the file-transfer is complete then you are sunk. Your
program will just sit there waiting for more characters.
There might be some way of sending the file that does indeed include an
eof marker (I don't know the MS-DOS utilities) but surely you can use
the MS-DOS COPY command to send more than one file, the last file could
then contain a sequence of characters that your AmigaBASIC routine
would recognise as end of transmission?
The only other thing I can think of involves waiting for a pre-set
period of time, if nothing else comes down the line during that time
then assume transmission has finished. The problem with this is that if
any delays occur on the sender side then you will detect a false end of
transmission.
REAL file transfer utilities wrap the encapsulated data in an envelope
that includes all the control & error checking data needed to detect
end of transmission and transmission errors, you might need to use one
of these or write your own.
|