Package qbuf :: Module twisted_support :: Class IntNStringReceiver

Class IntNStringReceiver

source code

twisted.internet.protocol.BaseProtocol --+        
                                         |        
        twisted.internet.protocol.Protocol --+    
                                             |    
                                 MultiBufferer --+
                                                 |
                                                IntNStringReceiver
Known Subclasses:

This class is identical to the IntNStringReceiver provided by Twisted, implemented using MultiBufferer as a demonstration of how MODE_STATEFUL works.

Instance Methods
 
getInitialState(self)
Called when there is no current state for MODE_STATEFUL.
source code
 
receiveLength(self, data) source code
 
receiveString(self, string) source code
 
sendString(self, data) source code
 
stringReceived(self, string) source code

Inherited from MultiBufferer: __init__, close, connectionLost, dataReceived, lineReceived, rawDataReceived, read, readline, setMode, unpack, write

Inherited from twisted.internet.protocol.BaseProtocol: __providedBy__, connectionMade, makeConnection

Class Variables
  mode = 2

Inherited from MultiBufferer: current_state, initial_delimiter

Inherited from twisted.internet.protocol.Protocol: __implemented__, __provides__

Inherited from twisted.internet.protocol.BaseProtocol: connected, transport

Properties

Inherited from MultiBufferer: delimiter

Method Details

getInitialState(self)

source code 

Called when there is no current state for MODE_STATEFUL.

This function must return a tuple of (some_callable, bytes_to_read), where the callable will be called when that number of bytes has been read, with those same bytes as the only argument. That callable can return None to keep the same (callable, n_bytes) state, or return a new (callable, n_bytes) tuple.

Overrides: MultiBufferer.getInitialState
(inherited documentation)