class documentation

A netstring receiver which keeps track of the strings received.

Method __init__ Undocumented
Method stringReceived Receive a string and append it to self.strings.
Instance Variable strings A list of received strings, in order.

Inherited from NetstringReceiver:

Method dataReceived Receives some characters of a netstring.
Method makeConnection Initializes the protocol.
Method sendString Sends a netstring.
Constant MAX_LENGTH Defines the maximum length of netstrings that can be received.
Instance Variable brokenPeer Indicates if the connection is still functional
Method _checkForTrailingComma Checks if the netstring has a trailing comma at the expected position.
Method _checkPartialLengthSpecification Makes sure that the received data represents a valid number.
Method _checkStringSize Checks the sanity of lengthAsString.
Method _consumeData Consumes the content of self._remainingData.
Method _consumeLength Consumes the length portion of self._remainingData.
Method _consumePayload Consumes the payload portion of self._remainingData.
Method _extractLength Attempts to extract the length information of a netstring.
Method _extractPayload Extracts payload information from self._remainingData.
Method _handleParseError Terminates the connection and sets the flag self.brokenPeer.
Method _maxLengthSize Calculate and return the string size of self.MAX_LENGTH.
Method _payloadComplete Checks if enough data have been received to complete the netstring.
Method _prepareForPayloadConsumption Sets up variables necessary for consuming the payload of a netstring.
Method _processLength Processes the length definition of a netstring.
Method _processPayload Processes the actual payload with stringReceived.
Constant _LENGTH A pattern describing all strings that contain a netstring length specification. Examples for length specifications are b'0:', b'12:', and b'179:'. b'007:' is not a valid length specification, since leading zeros are not allowed.
Constant _LENGTH_PREFIX A pattern describing all strings that contain the first part of a netstring length specification (without the trailing comma). Examples are '0', '12', and '179'. '007' does not start a netstring length specification, since leading zeros are not allowed.
Constant _MISSING_COMMA Undocumented
Constant _MISSING_LENGTH Undocumented
Constant _OVERFLOW Undocumented
Constant _PARSING_LENGTH Indicates that the NetstringReceiver is in the state of parsing the length portion of a netstring.
Constant _PARSING_PAYLOAD Indicates that the NetstringReceiver is in the state of parsing the payload portion (data and trailing comma) of a netstring.
Constant _TOO_LONG Undocumented
Instance Variable _currentPayloadSize Undocumented
Instance Variable _expectedPayloadSize Holds the payload size plus one for the trailing comma.
Instance Variable _payload Holds the payload portion of a netstring including the trailing comma
Instance Variable _remainingData Holds the chunk of data that has not yet been consumed
Instance Variable _state Indicates if the protocol is consuming the length portion (PARSING_LENGTH) or the payload (PARSING_PAYLOAD) of a netstring

Inherited from Protocol (via NetstringReceiver):

Method connectionLost Called when the connection is shut down.
Method logPrefix Return a prefix matching the class name, to identify log messages related to this protocol instance.
Class Variable factory Undocumented

Inherited from BaseProtocol (via NetstringReceiver, Protocol):

Method connectionMade Called when a connection is made.
Instance Variable connected Undocumented
Instance Variable transport Undocumented
def __init__(self): (source)

Undocumented

def stringReceived(self, string): (source)

Receive a string and append it to self.strings.

Parameters
stringThe string to be appended to self.strings.

A list of received strings, in order.