'retrieve and return the data stored in this channel\'s buffer.
If buffer is empty, return ""'

def recv(self, max_size=None):

    if (max_size and (max_size < len(self.buffer))):
        msg = self.buffer[0:max_size]
        self.buffer = self.buffer[max_size:]
    else:
        msg = self.buffer
        self.buffer = ''
    return msg
