(self, greeting, talk)
Helper to handle simple request-response protocols.
Helper to handle simple request-response protocols.
Helper to handle simple request - response protocols .
def do_conversation(self, greeting, talk):
        '''Helper to handle simple request-response protocols.'''
        self.request.sendall(greeting.encode('ascii'))

        for exp, resp in talk:
            data = self.request.recv(256).decode('ascii').upper()
            self.expect(data[:len(exp)] == exp, \
                'Expected ' + exp + ', got ' + data)
            self.request.sendall(resp.encode('ascii'))
def do_conversation ( self , greeting , talk ) : self . request . sendall ( greeting . encode ( 'ascii' ) ) for exp , resp in talk : data = self . request . recv ( 256 ) . decode ( 'ascii' ) . upper ( ) self . expect ( data [ : len ( exp ) ] == exp , 'Expected ' + exp + ', got ' + data ) self . request . sendall ( resp . encode ( 'ascii' ) )