0

How to receive the data from the client, bypassing the standard class function Protocol? For example,

class TW(protocol.Protocol):
    def get_data(delim = '\n'):
        #some code
        return data

I.e, without using the function "dataReceived", and not freezing all other the server clients?

Rubikoid
  • 3
  • 2

1 Answers1

0

You can't bypass dataReceived unless you like doing things the hard way :D. You can do what ever you're doing in get_data() in dataReceived(). Alternatively, you could add a data param in your get_data() and do a callback form dataReceived.

class TW(Protocol):
    def get_data(data, delim='\n'):
        # some code
        return result

    def dataReceived(self, data):
        result = self.get_data(data, delim='\r\n')
        # do some more stuff
notorious.no
  • 4,919
  • 3
  • 20
  • 34