Package twisted :: Package protocols :: Module ftp :: Class DTP
[show private | hide private]
[frames | no frames]

Class DTP

BaseProtocol --+    
               |    
        Protocol --+
                   |
                  DTP


A Client/Server-independent implementation of the DTP-protocol. Performs the actions RETR, STOR and LIST. The data transfer will start as soon as: 1) The user has connected 2) the property 'action' has been set.
Method Summary
  actionLIST(self, dir)
Prints outs the files in the given directory Note that the printout is very fake, and only gives the filesize, date, time and filename.
  actionNLST(self, dir)
  actionRETR(self, queuedfile)
Send the given file to the peer
  actionSTOR(self, queuedfile)
Retrieve a file from peer
  connectionFailed(self)
(Deprecated) (inherited from Protocol)
  connectionLost(self, reason)
Called when the connection is shut down.
  connectionMade(self)
Will start an transfer, if one is queued up, when the client connects
  dataReceived(self, data)
Called whenever data is received.
  executeAction(self)
Initiates a transfer of data.
  finishRETR(self)
Disconnect, and clean up a RETR Called by producer when the transfer is done
  makeRETRTransport(self)
  makeSTORTransport(self)
  setAction(self, action)
Set the action, and if the connected, start the transfer

Class Variable Summary
string action
None file
None filesize
None pi

Method Details

actionLIST(self, dir)

Prints outs the files in the given directory Note that the printout is very fake, and only gives the filesize, date, time and filename.

actionRETR(self, queuedfile)

Send the given file to the peer

actionSTOR(self, queuedfile)

Retrieve a file from peer

connectionLost(self, reason)

Called when the connection is shut down.

Clear any circular references here, and any external references to this Protocol. The connection has been closed.
Parameters:
reason
           (type=twisted.python.failure.Failure)
Overrides:
twisted.internet.protocol.Protocol.connectionLost (inherited documentation)

connectionMade(self)

Will start an transfer, if one is queued up, when the client connects

dataReceived(self, data)

Called whenever data is received.

Use this method to translate to a higher-level message. Usually, some callback will be made upon the receipt of each complete protocol message.
Parameters:
data - a string of indeterminate length. Please keep in mind that you will probably need to buffer some data, as partial (or multiple) protocol messages may be received! I recommend that unit tests for protocols call through to this method with differing chunk sizes, down to one byte at a time.
Overrides:
twisted.internet.protocol.Protocol.dataReceived (inherited documentation)

executeAction(self)

Initiates a transfer of data. Its action is based on self.action, and self.pi.queuedfile

finishRETR(self)

Disconnect, and clean up a RETR Called by producer when the transfer is done

setAction(self, action)

Set the action, and if the connected, start the transfer

Class Variable Details

action

Type:
string
Value:
''                                                                     

file

Type:
None
Value:
None                                                                   

filesize

Type:
None
Value:
None                                                                   

pi

Type:
None
Value:
None                                                                   

Generated by Epydoc 1.1 on Sat Feb 15 21:17:57 2003 http://epydoc.sf.net