5.3.5. vlcp.protocol.protocol

Note

This document is generated from the source file.

View Source on GitHub

Created on 2015/6/29

author:hubo
class vlcp.protocol.protocol.Protocol

Protocol base class

__init__()

Constructor

accept(server, newaddr, newsocket)

server accept :returns: new protocol object

beforelisten(tcpserver, newsocket)

routine before a socket entering listen mode

closed(connection)

routine for connection closed

error(connection)

routine for connection error

final(connection)

routine for a connection finally ends: all connections are closed and not retrying

init(connection)

routine for connection initialization

keepalive(connection)

routine executed when there has been a long time since last data arrival. Check if the connection is down.

notconnected(connection)

routine for connect failed and not retrying

parse(connection, data, laststart)

Parse input data into events

Parameters:
  • connection – connection object
  • data – view for input data
  • laststart – last parsed position
Returns:

(events, keep) where events are parsed events to send, keep is the unused data length to be keeped for next parse.

reconnect_init(connection)

routine for reconnect

serialize(connection, event)

Serialize a write event to bytes, and return if it is EOF

Parameters:
  • connection – connection object
  • event – write event
Returns:

(bytes, EOF)

serverfinal(tcpserver)

routine for a tcpserver finally shutdown or not connected