| Instance Variable |
MAX_LENGTH |
Defines the maximum length of netstrings that can be received. (type: int) |
| Instance Variable |
brokenPeer |
Indicates if the connection is still functional (type: int) |
| Method |
makeConnection |
Initializes the protocol. |
| Method |
sendString |
Sends a netstring. |
| Method |
dataReceived |
Receives some characters of a netstring. |
| Instance Variable |
_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. (type: re.Match) |
| Instance Variable |
_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. (type: re.Match) |
| Instance Variable |
_PARSING_LENGTH |
Indicates that the NetstringReceiver is in the state of
parsing the length portion of a netstring. (type: int) |
| Instance Variable |
_PARSING_PAYLOAD |
Indicates that the NetstringReceiver is in the state of
parsing the payload portion (data and trailing comma) of a netstring. (type: int) |
| Instance Variable |
_state |
Indicates if the protocol is consuming the length portion
(PARSING_LENGTH) or the payload (PARSING_PAYLOAD)
of a netstring (type: int) |
| Instance Variable |
_remainingData |
Holds the chunk of data that has not yet been consumed (type: string) |
| Instance Variable |
_payload |
Holds the payload portion of a netstring including the trailing comma (type: BytesIO) |
| Instance Variable |
_expectedPayloadSize |
Holds the payload size plus one for the trailing comma. (type: int) |
| Method |
_maxLengthSize |
Calculate and return the string size of
self.MAX_LENGTH. |
| Method |
_consumeData |
Consumes the content of self._remainingData. |
| Method |
_consumeLength |
Consumes the length portion of self._remainingData. |
| Method |
_checkPartialLengthSpecification |
Makes sure that the received data represents a valid number. |
| Method |
_processLength |
Processes the length definition of a netstring. |
| Method |
_extractLength |
Attempts to extract the length information of a netstring. |
| Method |
_checkStringSize |
Checks the sanity of lengthAsString. |
| Method |
_prepareForPayloadConsumption |
Sets up variables necessary for consuming the payload of a
netstring. |
| Method |
_consumePayload |
Consumes the payload portion of self._remainingData. |
| Method |
_extractPayload |
Extracts payload information from self._remainingData. |
| Method |
_payloadComplete |
Checks if enough data have been received to complete the netstring. |
| Method |
_processPayload |
Processes the actual payload with stringReceived. |
| Method |
_checkForTrailingComma |
Checks if the netstring has a trailing comma at the expected
position. |
| Method |
_handleParseError |
Terminates the connection and sets the flag
self.brokenPeer. |