Skip to Content
Exploring Expect
book

Exploring Expect

by Don Libes
December 1994
Intermediate to advanced
606 pages
16h 7m
English
O'Reilly Media, Inc.
Content preview from Exploring Expect

File Transfer Over telnet

The ftp program is handy for transferring files but it only works if the remote host is directly reachable via TCP. Suppose you have to telnet to a modem pool and then dial out to another modem to reach the remote host. Not only can ftp not handle this but neither can a lot of other communications programs. In Chapter 16 (p. 346), I presented a file transfer script that used rz and sz. Like many other communications programs, rz and sz require binary copies of their counterpart at each end of the link. If you do not have both, copying one to the other end can be a problem—if it was easy, you would not need the programs in the first place! Even worse, many versions of telnet and other programs do not provide 8-bit clean connections. So even if you had rz and sz, you might not be able to use them over a telnet connection.

The script below works over many kinds of links and does not require a copy of itself on the other end. The only assumptions made are that the usual UNIX utilities (such as cat and compress) exist and that the line is error free. If you do not have compress, that can be removed from the script as well. It is used only to speed the transfers.

The script is quite a bit fancier than the rz/sz script. This one interactively prompts for file names and other commands.

The script starts off by finding out what the prompt looks like. It then disables the default timeout. The script has a verbose mode so that the user can see what is happening internally. ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

AI Agents in Action

AI Agents in Action

Micheal Lanham
Learning Go

Learning Go

Jon Bodner

Publisher Resources

ISBN: 9781565920903Supplemental ContentErrata Page