'Read from the named pipe handle or the file handle.
This function returns imediatly and does not wait for the read
operation to complete. In case the read operation is not complete,
the property \'_read_pending\' will be set to True and the method
get_read_result should be called to retrieve the result. Otherwise,
the output of the read operation is returned.
:param bytes_to_read: int representing the maximum number of bytes
to be read.
:param from_namedpipe: boolean representing from where to read
True = the function reads from the named pipe handle
False = he function reads from the file handle'

def nonblocking_read(self, bytes_to_read, from_namedpipe=True):

    if self._read_pending:
        return
    handle_to_read = (self.namedpipe if from_namedpipe else self._npipe_file)
    (errCode, self._read_buffer) = ovs_winutils.read_file(handle_to_read, bytes_to_read, self._read)
    if errCode:
        if (errCode == ovs_winutils.winerror.ERROR_IO_PENDING):
            self._read_pending = True
        else:
            raise NamedPipeException('Could    not    read    from    named    pipe.', errCode)
        return None
    output = ''
    try:
        nBytesRead = ovs_winutils.get_overlapped_result(handle_to_read, self._read, False)
        self._read_pending = False
        output = ovs_winutils.get_decoded_buffer(self._read_buffer[:nBytesRead])
        win32event.SetEvent(self._read.hEvent)
    except NamedPipeException as e:
        if (e.code not in ovs_winutils.pipe_disconnected_errors):
            raise e
    return output
