mTCP FTP client 2009-04-26 Version Michael Brutman (mbbrutman@yahoo.com) Hardware requirements: 8088 processor or better Somewhere between 130KB and 180KB available RAM Display: doesn't matter, whatever you have Supported Ethernet card Software requirements: DOS 2.0 or newer (DOS 3.3 or newer recommended) Packet driver for your Ethernet card Introduction This is an FTP client like many other FTP clients you have used before. This is the first version of this FTP client, so it may be a little rough around the edges and I'm missing a few nice features. However, it is functional and it is fast when sending and receiving files. Requirements FTP is built using the mTCP library. The setup instructions for mTCP can be found in SETUP.TXT. Using Ftp FTP uses the following syntax: ftp [-port ] Options are: -help Show basic help text -port Connect using port instead of port 21 You have to specify the FTP server address on the command line. After the control socket is opened you will be prompted for a user ID and password. After that you get a command line just like on other FTP command line clients. Here are some of the commands: dir - directory list (full details) ls - directory list (names only) cd - change to a directory cdup - move up one directory pwd - print current working directory lcd - change local directory ascii - Set transfer type to 'ASCII' image - Set transfer type to 'image' or 'binary' get - Get a file put - Send a file mget - get multiple files mput - put multiple files prompt - Toggle mget/mput prompting on or off delete - Delete a file mkdir - Make directory rmdir - Remove directory rename - rename a file on the server quote - Send a command to the FTP server directly quit - Quit shell - Shell to DOS xfermode - Set default transfer mode - see section below The program captures Ctrl-Break and Ctrl-C. If you use Ctrl-Break during a file transfer or directory listing the current operation will stop (prematurely) and you will be returned to the command line after a brief delay. If you use Ctrl-Break or Ctrl-C at the command line the program will end. The shell command should be used with care. With the shell command you can do local directory listings, rename local files, look inside of files, and do most normal things. Keep in mind that while you are at the DOS command prompt the mTCP code is not servicing the socket connection - if you stay in DOS too long you might lose your connection to the FTP server. Transfer modes The xfermode command requires a little explanation. In the beginning of time FTP servers always sent data by doing a connect to the FTP client, which was listening for the incoming connection on a default port. The FTP server in NCSA telnet does this. I will call this 'Classic' mode and you can tell this FTP client to handle data transfers this way. 'Classic' mode is only useful for ancient FTP servers that can't do anything else. Most modern FTP servers will not connect to an FTP client on the default ports and most firewalls/routers wouldn't allow it anyway. 'Port' mode is the current default for many clients. Instead of having the FTP server connect to the client on default ports, the client will tell the FTP server exactly what port it should use for the connection. This is slightly better than Classic mode, and should be usable on more FTP servers, firewalls and routers. 'Passive' mode is probably the best and most compatible mode to use with modern FTP servers. It turns things around by making the client connect to the FTP server to make data connections instead of having the FTP server connect to the client. (From the standpoint of the FTP server it is 'passive' and it waits for a connection from the client.) This will work with almost any firewall and router. This is the mode I'd recommend using too. Advanced Configuration Parameters The default timeout for a socket connect is something around 10 seconds. If this is too short you can change it by adding a line to your mTCP configuration file. The parameter to set is called FTP_CONNECT_TIMEOUT. For example: FTP_CONNECT_TIMEOUT 15 will raise the timeout to 15 seconds. Environment variables Three environment variables are provided to help tailor FTP to your memory and performance requirements. TCPRCVBUF Default 8192, Range 512 to 16384 Use: Sets the size of the receive buffer that TCP/IP sets up for a socket connection. Bigger numbers generally result in higher performance. Use a smaller number if you are tight on memory and need to cut back on what FTP wants to use. If you are low on memory 4KB is a reasonable setting that will not hurt performance too much. FILEBUF Default 8192, Range 512 to 32768 Use: Sets the size of the buffer used to read and write files on your local disk. Bigger numbers generally result in higher performance. Use a smaller number if you are tight on memory and need to cut back on what FTP wants to use. If you are low on memory 4KB is a reasonable setting that will not hurt performance too much. MLISTBUF Default: 2048, Range 512 to 4096 Use: Sets the size of the buffer used to hold the list of files that mget and mput will use. If you are not using mget or mput you can set this number to the minimum. Limitations * Advanced command line editing would be nice Changes: 2009-01-18: First version - yay! 2009-04-15: Added mget, mput, rename, lcd General cleanup 2009-04-26: Added FTP_CONNECT_TIMEOUT support to mTCP configuration file Created January 18th, 2009, Last updated April 26th, 2009 (C)opyright Michael B. Brutman, mbbrutman@yahoo.com