'Read at most size bytes of data from the socket.'

def recv(self, size):

    if self._closed:
        raise SocketClosedError()
    if self._buf:
        out = self._buf[:size]
        self._buf = self._buf[size:]
        return ValueEvent(out)
    else:
        return ReceiveEvent(self, size)
