Send and receive data using RMCP interface.

        target:
        lun:
        netfn:
        cmdid:
        raw_bytes: IPMI message payload as bytestring

        Returns the received data as array.
11133
def _send_and_receive(self, target, lun, netfn, cmdid, payload):
        
        self._inc_sequence_number()

        header = IpmbHeaderReq()
        header.netfn = netfn
        header.rs_lun = lun
        header.rs_sa = target.ipmb_address
        header.rq_seq = self.next_sequence_number
        header.rq_lun = 0
        header.rq_sa = self.slave_address
        header.cmd_id = cmdid

        # Bridge message
        if target.routing:
            tx_data = encode_bridged_message(target.routing, header, payload,
                                             self.next_sequence_number)
        else:
            tx_data = encode_ipmb_msg(header, payload)

        self._send_ipmi_msg(tx_data)

        received = False
        while received is False:
            if not self._q.empty():
                rx_data = self._q.get()
            else:
                rx_data = self._receive_ipmi_msg()

            if array('B', rx_data)[5] == constants.CMDID_SEND_MESSAGE:
                rx_data = decode_bridged_message(rx_data)

            received = rx_filter(header, rx_data)

            if not received:
                self._q.put(rx_data)

        return rx_data[6:-1]
263384
def recvfrom(self, buffersize, flags=0):
        '''
        
        '''
        _,remoteaddr,data = self._recv(buffersize)
        return data,remoteaddr
286414
def __recieve_tcp_data(self, data_recv, size):
        
        data = []
        tcp_length = self.__test_tcp_top(data_recv)
        if self.verbose: print ("tcp_length {}, size {}".format(tcp_length, size))
        if tcp_length <= 0:
            if self.verbose: print ("Incorrect tcp packet")
            return None, b""
        if (tcp_length - 8) < size:
            if self.verbose: print ("tcp length too small... retrying")
            resp, bh = self.__recieve_tcp_data(data_recv, tcp_length - 8)
            data.append(resp)
            size -= len(resp)
            if self.verbose: print ("new tcp DATA packet to fill misssing {}".format(size))
            data_recv = bh + self.__sock.recv(size + 16 )
            if self.verbose: print ("new tcp DATA starting with {} bytes".format(len(data_recv)))
            resp, bh = self.__recieve_tcp_data(data_recv, size)
            data.append(resp)
            if self.verbose: print ("for misssing {} recieved {} with extra {}".format(size, len(resp), len(bh)))
            return b''.join(data), bh
        recieved = len(data_recv)
        if self.verbose: print ("recieved {}, size {}".format(recieved, size))
        response = unpack('HHHH', data_recv[8:16])[0]
        if recieved >= (size + 32):
            if response == const.CMD_DATA:
                resp = data_recv[16 : size + 16]
                if self.verbose: print ("resp complete len {}".format(len(resp)))
                return resp, data_recv[size + 16:]
            else:
                if self.verbose: print("incorrect response!!! {}".format(response))
                return None, b""
        else:
            if self.verbose: print ("try DATA incomplete (actual valid {})".format(recieved-16))
            data.append(data_recv[16 : size + 16 ])
            size -= recieved - 16
            broken_header = b""
            if size < 0:
                broken_header = data_recv[size:]
                if self.verbose: print ("broken", (broken_header).encode('hex'))
            if size > 0:
                data_recv = self.__recieve_raw_data(size)
                data.append(data_recv)
            return b''.join(data), broken_header
862402
async def receive(self, parameters: RTCRtpReceiveParameters):
        
        if not self.__started:
            for codec in parameters.codecs:
                self.__codecs[codec.payloadType] = codec
            for encoding in parameters.encodings:
                if encoding.rtx:
                    self.__rtx_ssrc[encoding.rtx.ssrc] = encoding.ssrc

            # start decoder thread
            self.__decoder_thread = threading.Thread(
                target=decoder_worker,
                name=self.__kind + '-decoder',
                args=(asyncio.get_event_loop(), self.__decoder_queue, self._track._queue))
            self.__decoder_thread.start()

            self.__transport._register_rtp_receiver(self, parameters)
            self.__rtcp_task = asyncio.ensure_future(self._run_rtcp())
            self.__started = True
760577
function receive(msg, rinfo){
    var packet = lob.decloak(msg);
    if(!packet) packet = lob.decode(msg); // accept un-encrypted discovery broadcast hints
    if(!packet) return mesh.log.info('dropping invalid packet from',rinfo,msg.toString('hex'));
    tp.pipe(false, {type:'udp4',ip:rinfo.address,port:rinfo.port}, function(pipe){
      mesh.receive(packet, pipe);
    });
  }
892188
def __bytes_to_share_data(self, payload):
        """"""
        rbytes = payload[P_DATA]
        mime = payload[P_MIME]

        if mime is None or not self.__auto_encode_decode:
            return rbytes, mime
        mime = expand_idx_mimetype(mime).lower()
        try:
            if mime == 'application/ubjson':
                return ubjloadb(rbytes), None
            elif mime == 'text/plain; charset=utf8':
                return rbytes.decode('utf-8'), None
            else:
                return rbytes, mime
        except:
            logger.warning('auto-decode failed, returning bytes', exc_info=DEBUG_ENABLED)
            return rbytes, mime
690555
def sendto(self, data, *args):
        '''
        
        '''
        remoteaddr = args[-1]
        remoteaddr = _normalize_addrs(remoteaddr)
        return self._send(data, (self._proto, self._local_addr[0], 
            self._local_addr[1], remoteaddr[0], remoteaddr[1]))
988993
def to_bytes(self):
        '''
        
        '''
        raw = b''
        if not self._options:
            return raw
        for icmpv6popt in self._options:
            raw += icmpv6popt.to_bytes()
        # Padding doesn't seem necessary?
        #   RFC states it should be padded to 'natural 64bit boundaries'
        #   However, wireshark interprets \x00 as a malformed option field
        #   So for now, ignore padding
        # padbytes = 4 - (len(raw) % 4)
        # raw += b'\x00'*padbytes
        return raw
291461
def receive(self, siz):
        
        result = bytearray()
        data = 'x'
        while len(data) > 0:
            data = self.sock.recv(siz - len(result))
            result += data
            if len(result) == siz:
                return result
            if len(result) > siz:
                raise Exception('Received more bytes than expected')
        raise Exception('Error receiving data. %d bytes received'%len(result))
557713
def data_received(self, data):
        
        self.time_out_handle.cancel()
        self.session.update(data.decode())

        if self.session.state == STATE_STARTING:
            self.transport.write(self.method.message.encode())
            self.time_out_handle = self.loop.call_later(
                TIME_OUT_LIMIT, self.time_out)

        elif self.session.state == STATE_PLAYING:
            self.callback(SIGNAL_PLAYING)

            if self.session.session_timeout != 0:
                interval = self.session.session_timeout - 5
                self.loop.call_later(interval, self.keep_alive)

        else:
            self.stop()
1338022
def recv_array(
        socket,
        flags=0,
        copy=False,
        track=False,
        poll=None,
        poll_timeout=10000
):
    
    if poll is None:
        md = socket.recv_json(flags=flags)
    else:
        # one-try "Lazy Pirate" method: http://zguide.zeromq.org/php:chapter4
        socks = dict(poll.poll(poll_timeout))
        if socks.get(socket) == zmq.POLLIN:
            reply = socket.recv_json(flags=flags)
            # note that reply can be an empty array
            md = reply
        else:
            raise NoResponseException(
                "Recv_array got no response within timeout (1)")

    if md['parts'] == 0:
        # No array expected
        A = None
    elif md['parts'] == 1:
        # although the check is not strictly necessary, we try to maintain fast
        # pointer transfer when there is only 1 part

        if poll is None:
            msg = socket.recv(flags=flags, copy=copy, track=track)
        else:
            # one-try "Lazy Pirate" method: http://zguide.zeromq.org/php:chapter4
            socks = dict(poll.poll(poll_timeout))
            if socks.get(socket) == zmq.POLLIN:
                reply = socket.recv(flags=flags, copy=copy, track=track)
                # note that reply can be an empty array
                msg = reply
            else:
                raise NoResponseException(
                    "Recv_array got no response within timeout (2)")
        buf = buffer(msg)
        A = np.frombuffer(buf, dtype=md['dtype'])
        A = A.reshape(md['shape'])

        if 'fill_value' in md:
            A = np.ma.masked_equal(A, md['fill_value'])

    else:
        # multi part array
        A = np.zeros(np.prod(md['shape']), dtype=md['dtype'])
        arr_position = 0
        for i in range(md['parts']):
            if poll is None:
                msg = socket.recv(flags=flags, copy=copy, track=track)
            else:
                # one-try "Lazy Pirate" method: http://zguide.zeromq.org/php:chapter4
                socks = dict(poll.poll(poll_timeout))
                if socks.get(socket) == zmq.POLLIN:
                    reply = socket.recv(flags=flags, copy=copy, track=track)
                    if not reply:
                        raise EmptyResponseException(
                            "Recv_array got an empty response (2)")
                    msg = reply
                else:
                    raise NoResponseException(
                        "Recv_array got no response within timeout (2)")
            buf = buffer(msg)
            a = np.frombuffer(buf, dtype=md['dtype'])
            A[arr_position:arr_position + a.shape[0]] = a[:]
            arr_position += a.shape[0]
        A = A.reshape(md['shape'])

        if 'fill_value' in md:
            A = np.ma.masked_equal(A, md['fill_value'])

    return A, md
268139
def send_rsp_recv_cmd(self, target, data, timeout):
        
        return super(Device, self).send_rsp_recv_cmd(target, data, timeout)
235782
def receive_data(data)
      #append data to buffer
      @data << data

      while (@data.length >=4)
        cmd_length = @data[0..3].unpack('N').first
        if(@data.length < cmd_length)
          #not complete packet ... break
          break
        end

        pkt = @data.slice!(0,cmd_length)

        begin
          # parse incoming PDU
          pdu = read_pdu(pkt)

          # let subclass process it
          process_pdu(pdu) if pdu
        rescue Exception => e
          logger.error "Error receiving data: #{e}\n#{e.backtrace.join("\n")}"
          run_callback(:data_error, e)
        end

      end
    end
28003
def sendmess(self, msgtype, payload, flags=0, size=0, offset=0, timeout=0):
        

        # reuse last valid connection or create new
        conn = self.conn or self._new_connection()
        # invalidate last connection
        self.conn = None

        flags |= self.flags
        assert (flags & FLG_PERSISTENCE)
        ret, rflags, data = conn.req(
            msgtype, payload, flags, size, offset, timeout)
        if rflags & FLG_PERSISTENCE:
            # persistence granted, save connection object for reuse
            self.conn = conn
        else:
            # discard connection object
            conn.shutdown()

        return ret, data
1181096
def receive_data(self):  # pragma: no cover; no covered since qt event loop
        ''' 
        '''
        while(not self._stop_readout.wait(0.01)):  # use wait(), do not block
            if self._send_data:
                if self.socket_type != zmq.DEALER:
                    raise RuntimeError('You send data without a bidirectional '
                                       'connection! Define a bidirectional '
                                       'connection.')
                self.receiver.send(self._send_data)
                self._send_data = None
            try:
                data_serialized = self.receiver.recv(flags=zmq.NOBLOCK)
                data = self.deserializer(data_serialized)
                self.data.emit(data)
            except zmq.Again:
                pass
        self.finished.emit()
1178914
def receive(self, data):
        
        self.log_debug("Received: %s" % (data))
        message =  self.make_message(data)
        self.trigger("receive", data=data, message=message)
        return message
856169
def get_data(self):
        ''' 
        '''
        fifo_size = self._intf._get_tcp_data_size()
        fifo_int_size = int((fifo_size - (fifo_size % 4)) / 4)
        data = self._intf._get_tcp_data(fifo_int_size * 4)
        return np.frombuffer(data, dtype=np.dtype('<u4'))