Table of Contents

Class: NetstringReceiver Twisted-0.17.4/twisted/protocols/basic.py

This uses djb's Netstrings protocol to break up the input into strings.

Each string makes a callback to stringReceived, with a single argument of that string.

Security features: 1) Messages are limited in size, useful if you don't want someone sending you a 500MB netstring (change MAX_LENGTH to the maximum length you wish to accept). 2) The connection is lost if an illegal message is received.

Base Classes   
protocol.Protocol
Methods   
dataReceived
doComma
doData
doLength
sendString
stringReceived
  dataReceived 
dataReceived ( self,  data )

Exceptions   
RuntimeError, "mode is not DATA, COMMA or LENGTH"
  doComma 
doComma ( self )

Exceptions   
NetstringParseError
NetstringParseError(repr( self.__data ) )
  doData 
doData ( self )

  doLength 
doLength ( self )

Exceptions   
NetstringParseError
NetstringParseError(repr( self.__data ) )
NetstringParseError, "netstring too long"
  sendString 
sendString ( self,  data )

  stringReceived 
stringReceived ( self,  line )

Override this.

Exceptions   
NotImplementedError

Table of Contents

This document was automatically generated on Sat Apr 20 01:31:04 2002 by HappyDoc version 2.0