The OpenNET Project / Index page

[ новости /+++ | форум | теги | ]

Поиск:  Каталог документации

B.2. ASCII upload and cat

cat is available on every UNIX-like system. It copies the data received from the keyboard to a file. Minicom and other terminal emulators have an "ASCII upload" facility that will send a file up the serial link as though it had been typed.

remote bash$ cat > upload.txt
Alt-S Upload ascii
[ascii upload - Press CTRL-C to quit]

Wait for upload to complete…

ASCII upload of "upload.txt"
10.0 Kbytes transferred at 3900 CPS... Done.
READY: press any key to continue...
Ctrl-D
remote bash$

Without hardware flow control ASCII upload will drop the occassional character.

To upload binary files encode them into ASCII, upload them, and then decode them into binary again.

localhost bash$ uuencode upload.bin < upload.bin > upload.txt
Alt-S Upload ascii
[ascii upload - Press CTRL-C to quit]

Wait for upload to complete…

ASCII upload of "upload.txt"
10.0 Kbytes transferred at 3900 CPS... Done.
READY: press any key to continue...
Ctrl-D
remote bash$
remote bash$ uudecode < upload.txt

You can detect transmission errors by using a checksum program such as sum, cksum or md5sum. Print the ckecksum of the file before it is sent from the local machine and after it is recieved upon the remote machine.

localhost bash$ cksum upload.bin
1719761190 76 upload.bin
remote bash$ cksum upload.bin
1719761190 76 upload.bin

There are a number of checksumming programs. The sum command should be used with caution, as there are versions for BSD and System V UNIX which give differing results. cksum is the attempt by the POSIX standards developers to correct that mess: it gives the same result for the same file on all POSIX machines.

If the checksums of the original and uploaded files do not match then the file will have to be uploaded again. If the link is noisy and the file is big then you may never get a successful upload. What is needed in this case is to divide the file into many small parts, upload a part, check its checksum, and if it is fine proceed to the next part.

This sounds like something that should be automated. Entering from stage left is Xmodem.




Партнёры:
PostgresPro
Inferno Solutions
Hosting by Hoster.ru
Хостинг:

Закладки на сайте
Проследить за страницей
Created 1996-2024 by Maxim Chirkov
Добавить, Поддержать, Вебмастеру