FTP Library Package 1.2 for Tcl/Tk Manual Pages

NAME
ftp_lib - Client-side tcl implementation of the FTP protocol
 
SYNOPSIS
package require FTP ?1.2?
 
FTP::Open  server  user  passwd  ?options?
FTP::Close
FTP::Cd  directory
FTP::Pwd
FTP::Type  ?ascii|binary?
FTP::List  ?directory?
FTP::NList  ?directory?
FTP::FileSize  file
FTP::ModTime  file 
FTP::Delete  file
FTP::Rename  from  to
FTP::Put  local  ?remote?
FTP::Append  local  ?remote?
FTP::Get  remote  ?local?
FTP::Reget  remote  ?local?
FTP::Newer  remote  ?local?
FTP::MkDir  directory
FTP::RmDir  directory
FTP::Quote  arg1  arg2  ...
FTP::DisplayMsg  msg  ?state?
 
variable FTP::VERBOSE
variable FTP::DEBUG
 
DESCRIPTION
The FTP library package provides the client side of the ftp protocol. The package implements active (default) and passive ftp sessions.

A new ftp session is started with the Open command. Quitting an existing ftp session is done by Close. All other commands can only be used in an opened FTP session else an error will occured. Ftp_lib includes file and directory manipulating commands for remote site. To do the same stuff to the local site the built-in tcl commands like "cd" or "file command" are the best choice.

Two state variables controls the output of ftp_lib. Setting VERBOSE to "1" forces to show all responses from the remote server. The default value is "0". Setting DEBUG to "1" enables debugging to show all the return code, states and "real" ftp commands. The default value is "0".

The procedure DisplayMsg is used to show the different messages from the ftp session. It is simple declared in ftp_lib and must be overwritten by the programmer to make it more comfortable. A state variable for different states assigned to different colors is recommended by the author. For example:

.msg.text tag configure error -foreground red
.msg.text tag configure data -foreground brown
.msg.text tag configure control -foreground blue

namespace eval FTP {
proc DisplayMsg {msg {state ""}} {
    switch $state {
        data	{.msg.text insert end "$msg\n" data}
        control	{.msg.text insert end "$msg\n" control}
	error	{.msg.text insert end "$msg\n" error}
    }	   
}}
BUGS
Correct execution of many commands depends upon proper behavior by the remote server, network and router configuration.

An update command placed in the procedure DisplayMsg run into persistent errors or infinite loops. The solution to this problem is to use "update idletasks", rather than a single update.


© 1999 Steffen Traeger