A protocol which has a mode where it receives lines, and a mode where it receives raw data.
Each line that's received becomes a callback to lineReceived. Each
chunk of raw data becomes a callback to rawDataReceived.
This is useful for line-oriented protocols such as IRC, HTTP, POP,
etc.
Methods
|
|
dataReceived
lineReceived
rawDataReceived
sendLine
setLineMode
setRawMode
|
|
dataReceived
|
dataReceived ( self, data )
Protocol.dataReceived.
Translates bytes into lines, and calls lineReceived (or
rawDataReceived, depending on mode.)
|
|
lineReceived
|
lineReceived ( self, line )
Override this for when each line is received.
|
|
rawDataReceived
|
rawDataReceived ( self, data )
Override this for when raw data is received.
|
|
sendLine
|
sendLine ( self, line )
Sends a line to the other end of the connection.
|
|
setLineMode
|
setLineMode ( self, extra='' )
Sets the line-mode of this receiver.
If you are calling this from a rawDataReceived callback,
you can pass in extra unhandled data, and that data will
be parsed for lines. Further data received will be sent
to lineReceived rather than rawDataReceived.
|
|
setRawMode
|
setRawMode ( self )
Sets the raw mode of this receiver.
Further data received will be sent to rawDataReceived rather
than lineReceived.
|
|