Package twisted :: Package protocols :: Module ftp :: Class DTP
[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
  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
  makeRETRTransport(self)
  makeSTORTransport(self)
  setAction(self, action)
Set the action, and if the connected, start the transfer
    Inherited from Protocol
  connectionFailed(self)
(Deprecated)
    Inherited from BaseProtocol
  makeConnection(self, transport)
Make a connection to a transport and a server.

Class Variable Summary
str action = ''
NoneType file = None                                                                  
NoneType filesize = None                                                                  
NoneType pi = None                                                                  
    Inherited from Protocol
tuple __implements__ = (<class twisted.internet.interfaces.IPr...
    Inherited from BaseProtocol
int connected = 0                                                                     
NoneType transport = None                                                                  

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 2.0 on Sat Oct 25 00:54:49 2003 http://epydoc.sf.net