send RC override packet
166945
def send_rc_override(self):
        ''''''
        if self.sitl_output:
            buf = struct.pack('<HHHHHHHH',
                              *self.override)
            self.sitl_output.write(buf)
        else:
            self.master.mav.rc_channels_override_send(self.target_system,
                                                           self.target_component,
                                                           *self.override)
1145358
async def receive(self, pkt):
        """"""
        self.server.logger.info('%s: Received packet %s data %s',
                                self.sid, packet.packet_names[pkt.packet_type],
                                pkt.data if not isinstance(pkt.data, bytes)
                                else '<binary>')
        if pkt.packet_type == packet.PING:
            self.last_ping = time.time()
            await self.send(packet.Packet(packet.PONG, pkt.data))
        elif pkt.packet_type == packet.MESSAGE:
            await self.server._trigger_event(
                'message', self.sid, pkt.data,
                run_async=self.server.async_handlers)
        elif pkt.packet_type == packet.UPGRADE:
            await self.send(packet.Packet(packet.NOOP))
        elif pkt.packet_type == packet.CLOSE:
            await self.close(wait=False, abort=True)
        else:
            raise exceptions.UnknownPacketError()
331850
async def _send_packet(self, pkt):
        """"""
        if self.state != 'connected':
            return
        await self.queue.put(pkt)
        self.logger.info(
            'Sending packet %s data %s',
            packet.packet_names[pkt.packet_type],
            pkt.data if not isinstance(pkt.data, bytes) else '<binary>')
912679
def _send(self, packet):
        """"""
        fut = self.loop.create_future()
        self.waiters.append((fut, packet))
        if self.waiters and self.in_transaction is False:
            self.protocol.send_packet()
        return fut
1153555
def ping(payload, &blk)
      send(type: :ping, stream: 0, payload: payload)
      once(:ack, &blk) if blk
    end
1262027
def _sndrcv_snd(pks, timeout, inter, verbose, tobesent, hsent, timessent, stopevent):  # noqa: E501
    """"""
    try:
        i = 0
        rec_time = timessent is not None
        if verbose:
            print("Begin emission:")
        for p in tobesent:
            # Populate the dictionary of _sndrcv_rcv
            # _sndrcv_rcv won't miss the answer of a packet that has not been sent  # noqa: E501
            hsent.setdefault(p.hashret(), []).append(p)
            if stopevent.is_set():
                break
            # Send packet
            pks.send(p)
            if rec_time:
                timessent[i] = p.sent_time
            i += 1
            time.sleep(inter)
        if verbose:
            print("Finished sending %i packets." % i)
    except SystemExit:
        pass
    except KeyboardInterrupt:
        pass
    except Exception:
        log_runtime.exception("--- Error sending packets")
    if timeout is not None:
        def _timeout(stopevent):
            stopevent.wait(timeout)
            stopevent.set()
        thread = threading.Thread(
            target=_timeout, args=(stopevent,)
        )
        thread.setDaemon(True)
        thread.start()
65237
def send(self, sock, msg):
    """"""
    data = pickle.dumps(msg)
    buf = struct.pack('>I', len(data)) + data
    sock.sendall(buf)
326975
async def send_rpc(self, conn_id, address, rpc_id, payload, timeout):
        

        self._ensure_connection(conn_id, True)
        connection_string = self._get_property(conn_id, "connection_string")

        msg = dict(address=address, rpc_id=rpc_id, payload=base64.b64encode(payload),
                   timeout=timeout, connection_string=connection_string)

        response = await self._send_command(OPERATIONS.SEND_RPC, msg, COMMANDS.SendRPCResponse,
                                            timeout=timeout)

        return unpack_rpc_response(response.get('status'), response.get('payload'),
                                   rpc_id=rpc_id, address=address)
1204896
def send_packet(self):
        """"""
        waiter, packet = self.client.waiters.popleft()
        self.logger.debug('sending packet: %s', binascii.hexlify(packet))
        self.client.active_transaction = waiter
        self.client.in_transaction = True
        self.client.active_packet = packet
        self.reset_cmd_timeout()
        self.transport.write(packet)
485341
def _send_packet(self, data):
        
        if self._closed:
            return

        data = json.dumps(data)

        def send():
            try:
                yield From(self.pipe_connection.write(data))
            except BrokenPipeError:
                self.detach_and_close()
        ensure_future(send())
595367
def send_command(self, device_id, action):
        """"""
        command = deserialize_packet_id(device_id)
        command['command'] = action
        log.debug('sending command: %s', command)
        self.send_packet(command)
617023
def _send_packet_safe(self, cr, packet):
        
        # packet = bytearray(packet)
        packet[0] &= 0xF3
        packet[0] |= self._curr_up << 3 | self._curr_down << 2
        resp = cr.send_packet(packet)
        if resp and resp.ack and len(resp.data) and \
           (resp.data[0] & 0x04) == (self._curr_down << 2):
            self._curr_down = 1 - self._curr_down
        if resp and resp.ack:
            self._curr_up = 1 - self._curr_up

        return resp
65016
def handle(self, pkt, raddress, rport):
        """"""
        if not self.context.tidport:
            self.context.tidport = rport
            log.info("Set remote port for session to %s" % rport)

        # Now check the packet type and dispatch it properly.
        if isinstance(pkt, TftpPacketOACK):
            log.info("Received OACK from server")
            try:
                self.handleOACK(pkt)
            except TftpException as err:
                log.error("Failed to negotiate options: %s" % str(err))
                self.sendError(TftpErrors.FailedNegotiation)
                raise
            else:
                log.debug("Sending ACK to OACK")

                self.sendACK(blocknumber=0)

                log.debug("Changing state to TftpStateExpectDAT")
                return TftpStateExpectDAT(self.context)

        elif isinstance(pkt, TftpPacketDAT):
            # If there are any options set, then the server didn't honour any
            # of them.
            log.info("Received DAT from server")
            if self.context.options:
                log.info("Server ignored options, falling back to defaults")
                self.context.options = { 'blksize': DEF_BLKSIZE }
            return self.handleDat(pkt)

        # Every other packet type is a problem.
        elif isinstance(pkt, TftpPacketACK):
            # Umm, we ACK, the server doesn't.
            self.sendError(TftpErrors.IllegalTftpOp)
            raise TftpException("Received ACK from server while in download")

        elif isinstance(pkt, TftpPacketWRQ):
            self.sendError(TftpErrors.IllegalTftpOp)
            raise TftpException("Received WRQ from server while in download")

        elif isinstance(pkt, TftpPacketERR):
            self.sendError(TftpErrors.IllegalTftpOp)
            log.debug("Received ERR packet: %s", pkt)
            if pkt.errorcode == TftpErrors.FileNotFound:
                raise TftpFileNotFoundError("File not found")
            else:
                raise TftpException("Received ERR from server: {}".format(pkt))

        else:
            self.sendError(TftpErrors.IllegalTftpOp)
            raise TftpException("Received unknown packet type from server: %s" % pkt)

        # By default, no state change.
        return self
595800
def handle_packet(self, packet):
        """"""

        if not isinstance(packet, RTMPPacket):
            raise ValueError("A RTMPPacket argument is required")

        return librtmp.RTMP_ClientPacket(self.rtmp, packet.packet)
1182882
def respond(self, packet, peer, flags=0):
        
        self.sock.sendto(packet, flags, peer)
418696
def _send_ffe(self, pid, app_id, app_flags, fr):
        
        arg1 = (NNCommands.flood_fill_end << 24) | pid
        arg2 = (app_id << 24) | (app_flags << 18)
        self._send_scp(255, 255, 0, SCPCommands.nearest_neighbour_packet,
                       arg1, arg2, fr)
1042965
private void sendGenericNack(Pdu packet){
		
		GenericNack genericNack = new GenericNack();
		genericNack.setSequenceNumber(packet.getSequenceNumber());
	    genericNack.setCommandStatus(SmppConstants.STATUS_INVCMDID);

		ChannelBuffer buffer = null;
		try {
			buffer = transcoder.encode(genericNack);
			
		} catch (UnrecoverablePduException e) {
			logger.error("Encode error: ", e);
		}catch(RecoverablePduException e){
			logger.error("Encode error: ", e);
		}
		
		if(logger.isDebugEnabled())
			logger.debug("LB sent generic_nack response for packet ("+ packet +") to " + channel.getRemoteAddress().toString() + ". session ID : " + sessionId);
		channel.write(buffer);
	}