Part of twisted.protocols.ftp View Source View In Hierarchy
|Instance Variable||state||The current server state. One of
|Instance Variable||shell||The connected avatar|
|Instance Variable||binary||The transfer mode. If false, ASCII.|
|Instance Variable||dtpFactory||Generates a single DTP for this session|
|Instance Variable||dtpPort||Port returned from listenTCP|
|Instance Variable||listenFactory||A callable with the signature of
|Instance Variable||passivePortRange||iterator used as source of passive port numbers. (type:
|Method||connectionMade||Called when a connection is made.|
|Method||connectionLost||Called when the connection is shut down.|
|Method||timeoutConnection||Called when the connection times out.|
|Method||lineReceived||Override this for when each line is received.|
|Method||getDTPPort||Return a port for passive access, using
|Method||ftp_USER||First part of login. Get the username the peer wants to authenticate as.|
|Method||ftp_PASS||Second part of login. Get the password the peer wants to authenticate with.|
|Method||ftp_PASV||Request for a passive connection|
|Method||ftp_RETR||This command causes the content of a file to be sent over the data transfer channel. If the path is to a folder, an error will be raised.|
|Method||ftp_MDTM||File Modification Time (MDTM)|
|Method||ftp_TYPE||REPRESENTATION TYPE (TYPE)|
|Method||ftp_FEAT||Advertise the features supported by the server.|
|Method||ftp_OPTS||Handle OPTS command.|
|Method||cleanupDTP||Call when DTP connection exits|
Inherited from LineReceiver:
|Class Variable||delimiter||The line-ending delimiter to use. By default this is
|Class Variable||MAX_LENGTH||The maximum length of a line to allow (If a sent line is longer than this, the connection is dropped). Default is 16384.|
|Method||clearLineBuffer||Clear buffered data.|
|Method||dataReceived||Protocol.dataReceived. Translates bytes into lines, and calls lineReceived (or rawDataReceived, depending on mode.)|
|Method||setLineMode||Sets the line-mode of this receiver.|
|Method||setRawMode||Sets the raw mode of this receiver. Further data received will be sent to rawDataReceived rather than lineReceived.|
|Method||rawDataReceived||Override this for when raw data is received.|
|Method||sendLine||Sends a line to the other end of the connection.|
|Method||lineLengthExceeded||Called when the maximum line length has been reached. Override if it needs to be dealt with in some special way.|
|Method||logPrefix||Return a prefix matching the class name, to identify log messages related to this protocol instance.|
|Method||makeConnection||Make a connection to a transport and a server.|
Inherited from TimeoutMixin:
|Class Variable||timeOut||The number of seconds after which to timeout the connection.|
|Method||resetTimeout||Reset the timeout count down.|
|Method||setTimeout||Change the timeout period|
twisted.internet.interfaces.IReactorTCP.listenTCPwhich will be used to create Ports for passive connections (mainly for testing).
This may be considered the initializer of the protocol, because it is called when the connection is completed. For clients, this is called once the connection to the server has been established; for servers, this is called after an accept() call stops blocking and a socket has been received. If you need to send any greeting or initial message, do it here.
Override to define behavior other than dropping the connection.
|Parameters||line||The line which was received with the delimiter removed. (type: |
Request for a passive connection
from the rfc:
This command requests the server-DTP to "listen" on a data port (which is not its default data port) and to wait for a connection rather than initiate one upon receipt of a transfer command. The response to this command includes the host and port address this server is listening on.
|Parameters||path||The path for which a directory listing should be returned. (type: |
|Parameters||path||The path to the file which should be transferred over the data transfer
channel. (type: |
The FTP command, SIZE OF FILE (SIZE), is used to obtain the transfer size of a file from the server-FTP process. This is the exact number of octets (8 bit bytes) that would be transmitted over the data connection should that file be transmitted. This value will change depending on the current STRUcture, MODE, and TYPE of the data connection or of a data connection that would be created were one created now. Thus, the result of the SIZE command is dependent on the currently established STRU, MODE, and TYPE parameters.
The SIZE command returns how many octets would be transferred if the file were to be transferred using the current transfer structure, mode, and type. This command is normally used in conjunction with the RESTART (REST) command when STORing a file to a remote server in STREAM mode, to determine the restart point. The server-PI might need to read the partially transferred file, do any appropriate conversion, and count the number of octets that would be generated when sending the file in order to correctly respond to this command. Estimates of the file transfer size MUST NOT be returned; only precise information is acceptable.
The FTP command, MODIFICATION TIME (MDTM), can be used to determine when a file in the server NVFS was last modified. This command has existed in many FTP servers for many years, as an adjunct to the REST command for STREAM mode, thus is widely available. However, where supported, the "modify" fact that can be provided in the result from the new MLST command is recommended as a superior alternative.
The argument specifies the representation type as described in the Section on Data Representation and Storage. Several types take a second parameter. The first parameter is denoted by a single Telnet character, as is the second Format parameter for ASCII and EBCDIC; the second parameter for local byte is a decimal integer to indicate Bytesize. The parameters are separated by a <SP> (Space, ASCII code 32).