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)
  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
  makeConnection(self, transport)
Make a connection to a transport and a server. (inherited from BaseProtocol)
  makeRETRTransport(self)
  makeSTORTransport(self)
  setAction(self, action)
Set the action, and if the connected, start the transfer

Class Variable Summary
str action
NoneType file
NoneType filesize
NoneType 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

connectionMade(self)

Will start an transfer, if one is queued up, when the client connects
Overrides:
twisted.internet.protocol.BaseProtocol.connectionMade

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:
str
Value:
''                                                                     

file

Type:
NoneType
Value:
None                                                                   

filesize

Type:
NoneType
Value:
None                                                                   

pi

Type:
NoneType
Value:
None                                                                   

Generated by Epydoc 1.2 prerelease on Wed Jan 29 06:28:23 2003 http://epydoc.sf.net