Interface Of The Protocol Class

While investigating the possible uses for the Twisted Networking Engine, I found it hard to find examples that describe the Interface of the Protocol class. So, I will share this brief code snippet with you.

Protocol Class

A Protocol class can have the following methods for event-driven TCP connections:

MyProtocol(Protocol):         

  def makeConnection(self, transport):
    ''' code '''         

  def connectionMade(self):
    ''' code '''

  def dataReceived(self, data):
    '''' code ''''

  def connectionLost(self, reason):
    ''' code '''

Read full article here >>