'Calls self.protocol.dataReceived with all available data.
This reads up to self.bufferSize bytes of data from its socket, then
calls self.dataReceived(data) to process it.  If the connection is not
lost through an error in the physical recv(), this function will return
the result of the dataReceived call.'

def doRead(self):

    try:
        data = self.socket.recv(self.bufferSize)
    except socket.error as se:
        if (se.args[0] == EWOULDBLOCK):
            return
        else:
            return main.CONNECTION_LOST
    return self._dataReceived(data)
