#NEWLINE# def data_received( self , data ) : #NEWLINE# #INDENT# 'Overrides Protocol method, to handle incoming data.' #NEWLINE# if ( not self . response_data ) : #NEWLINE# #INDENT# self . response_data = data #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . response_data += data #NEWLINE# #UNINDENT# expect_len = struct . unpack ( b'!L' , self . response_data [ : 4 ] ) [ 0 ] #NEWLINE# if ( ( len ( self . response_data ) - 4 ) == expect_len ) : #NEWLINE# #INDENT# payload = self . response_data [ 4 : ] #NEWLINE# self . response_data = None #NEWLINE# self . process_payload ( payload )