| Title: | AMIGA NOTES |
| Notice: | Join us in the *NEW* conference - HYDRA::AMIGA_V2 |
| Moderator: | HYDRA::MOORE |
| Created: | Sat Apr 26 1986 |
| Last Modified: | Wed Feb 05 1992 |
| Last Successful Update: | Fri Jun 06 1997 |
| Number of topics: | 5378 |
| Total number of notes: | 38326 |
I'm trying to use AmigaBasic to create a simple file transfer routine
using COM1.
Unfortunately, whereas writing out files appears easy and I've had no
problems there, reading data in has proved somewhat troublesome.
o I can't use LOF to determine how much data is coming through - it
is just a stream of data.
o I can't use EOF() since the port always appears to be at the
end-of-file.
o Although the other end of the port is sending MS-DOS files which
also use ^Z as the end-of-file character, this does not seem to
be sent using an MS-DOS COPY statement.
I have had some success using INPUT$ to a channel, but unless I can
detect the real end of file it means manual intervention. Is there any
concept of INKEY$ for a channel or is there some other way I can read
from the serial device without having to wait?
My only alternative (which certainly works and may even be the best
way) is to use something like the ASCII RECEIVE in HandShake (but I'm
a glutton for punishment).
David.
| T.R | Title | User | Personal Name | Date | Lines |
|---|---|---|---|---|---|
| 4226.1 | I had this problem too | SIOG::OBRIEN_PAUL | Gross-out Factor 9! | Wed Oct 31 1990 08:06 | 28 |
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.
| |||||