encode NPDUs from the service access point and send them downstream.
540812
def process_npdu(self, npdu):
        """"""
        if _debug: DeviceToDeviceClientService._debug("process_npdu %r", npdu)

        # broadcast messages go to everyone
        if npdu.pduDestination.addrType == Address.localBroadcastAddr:
            destList = self.connections.keys()
        else:
            conn = self.connections.get(npdu.pduDestination, None)
            if not conn:
                if _debug: DeviceToDeviceClientService._debug("    - not a connected client")

                # start a connection attempt
                conn = self.connect(npdu.pduDestination)
            if not conn.connected:
                # keep a reference to this npdu to send after the ack comes back
                conn.pendingNPDU.append(npdu)
                return

            destList = [npdu.pduDestination]
        if _debug: DeviceToDeviceClientService._debug("    - destList: %r", destList)

        for dest in destList:
            # make device-to-device APDU
            xpdu = DeviceToDeviceAPDU(npdu)
            xpdu.pduDestination = dest

            # send it down to the multiplexer
            self.service_request(xpdu)
358406
private void sendPublishStopNotify() {
        Status stopStatus = new Status(StatusCodes.NS_UNPUBLISHED_SUCCESS);
        stopStatus.setClientid(getStreamId());
        stopStatus.setDetails(getPublishedName());

        StatusMessage stopMsg = new StatusMessage();
        stopMsg.setBody(stopStatus);
        pushMessage(stopMsg);
        setState(StreamState.STOPPED);
    }
598668
def encode(self, pdu):
        """"""
        if _debug: NPCI._debug("encode %s", repr(pdu))

        PCI.update(pdu, self)

        # only version 1 messages supported
        pdu.put(self.npduVersion)

        # build the flags
        if self.npduNetMessage is not None:
            netLayerMessage = 0x80
        else:
            netLayerMessage = 0x00

        # map the destination address
        dnetPresent = 0x00
        if self.npduDADR is not None:
            dnetPresent = 0x20

        # map the source address
        snetPresent = 0x00
        if self.npduSADR is not None:
            snetPresent = 0x08

        # encode the control octet
        control = netLayerMessage | dnetPresent | snetPresent
        if self.pduExpectingReply:
            control |= 0x04
        control |= (self.pduNetworkPriority & 0x03)
        self.npduControl = control
        pdu.put(control)

        # make sure expecting reply and priority get passed down
        pdu.pduExpectingReply = self.pduExpectingReply
        pdu.pduNetworkPriority = self.pduNetworkPriority

        # encode the destination address
        if dnetPresent:
            if self.npduDADR.addrType == Address.remoteStationAddr:
                pdu.put_short(self.npduDADR.addrNet)
                pdu.put(self.npduDADR.addrLen)
                pdu.put_data(self.npduDADR.addrAddr)
            elif self.npduDADR.addrType == Address.remoteBroadcastAddr:
                pdu.put_short(self.npduDADR.addrNet)
                pdu.put(0)
            elif self.npduDADR.addrType == Address.globalBroadcastAddr:
                pdu.put_short(0xFFFF)
                pdu.put(0)

        # encode the source address
        if snetPresent:
            pdu.put_short(self.npduSADR.addrNet)
            pdu.put(self.npduSADR.addrLen)
            pdu.put_data(self.npduSADR.addrAddr)

        # put the hop count
        if dnetPresent:
            pdu.put(self.npduHopCount)

        # put the network layer message type (if present)
        if netLayerMessage:
            pdu.put(self.npduNetMessage)
            # put the vendor ID
            if (self.npduNetMessage >= 0x80) and (self.npduNetMessage <= 0xFF):
                pdu.put_short(self.npduVendorID)
1174505
function () {
      const encodeABI = contract.deploy(options).encodeABI();
      txParams.data = encodeABI;

      return new Promise(function (onResolve, onReject) {
        web3Provider.eth.sendTransaction(txParams)
          .on('transactionHash', function(transactionHash){
            onResolve(transactionHash)
          })
          .on('error', onReject);
      });
    }
1333115
def process_npdu(self, npdu):
        """"""
        if _debug: NetworkAdapter._debug("process_npdu %r (net=%r)", npdu, self.adapterNet)

        pdu = PDU(user_data=npdu.pduUserData)
        npdu.encode(pdu)
        self.request(pdu)
6597
def encode_request(timeout, durability, transaction_type, thread_id):
    
    client_message = ClientMessage(payload_size=calculate_size(timeout, durability, transaction_type, thread_id))
    client_message.set_message_type(REQUEST_TYPE)
    client_message.set_retryable(RETRYABLE)
    client_message.append_long(timeout)
    client_message.append_int(durability)
    client_message.append_int(transaction_type)
    client_message.append_long(thread_id)
    client_message.update_frame_length()
    return client_message
1247262
def _process_outgoing(self, xmlstream, token):
        

        self._send_stanza(xmlstream, token)
        # try to send a bulk
        while True:
            try:
                token = self._active_queue.get_nowait()
            except asyncio.QueueEmpty:
                break
            self._send_stanza(xmlstream, token)

        if self._sm_enabled:
            self._logger.debug("sending SM req")
            xmlstream.send_xso(nonza.SMRequest())
246560
def RPC(self, url, opname, obj, replytype=None, **kw):
        '''
        '''
        self.Send(url, opname, obj, **kw)
        return self.Receive(replytype, **kw)
689222
def encode(self, pdu):
        """"""
        if _debug: BVLCI._debug("encode %s", str(pdu))

        # copy the basics
        PCI.update(pdu, self)

        pdu.put( self.bvlciType )               # 0x81
        pdu.put( self.bvlciFunction )

        if (self.bvlciLength != len(self.pduData) + 4):
            raise EncodingError("invalid BVLCI length")

        pdu.put_short( self.bvlciLength )
411092
function sendPayload(payload) {
		var builtPayload = payload.build();
		for (var i=0; i<emitters.length; i++) {
			emitters[i].input(builtPayload);
		}
	}
779512
def net_send(out_data, conn):
    '''  '''
    print('Sending {} bytes'.format(len(out_data)))
    conn.send(out_data)
1356721
def sendPdu(self, snmpEngine, transportDomain, transportAddress,
                messageProcessingModel, securityModel, securityName,
                securityLevel, contextEngineId, contextName,
                pduVersion, PDU, expectResponse, timeout=0,
                cbFun=None, cbCtx=None):
        """"""
        # 4.1.1.2
        k = int(messageProcessingModel)

        if k in snmpEngine.messageProcessingSubsystems:
            mpHandler = snmpEngine.messageProcessingSubsystems[k]

        else:
            raise error.StatusInformation(
                errorIndication=errind.unsupportedMsgProcessingModel)

        debug.logger & debug.FLAG_DSP and debug.logger(
            'sendPdu: securityName %s, PDU\n'
            '%s' % (securityName, PDU.prettyPrint()))

        # 4.1.1.3
        sendPduHandle = self._sendPduHandle()

        if expectResponse:
            self._cache.add(
                sendPduHandle,
                messageProcessingModel=messageProcessingModel,
                sendPduHandle=sendPduHandle,
                timeout=timeout + snmpEngine.transportDispatcher.getTimerTicks(),
                cbFun=cbFun,
                cbCtx=cbCtx
            )

            debug.logger & debug.FLAG_DSP and debug.logger(
                'sendPdu: current time %d ticks, one tick is %s '
                'seconds' % (snmpEngine.transportDispatcher.getTimerTicks(),
                             snmpEngine.transportDispatcher.getTimerResolution()))

        debug.logger & debug.FLAG_DSP and debug.logger(
            'sendPdu: new sendPduHandle %s, timeout %s ticks, cbFun '
            '%s' % (sendPduHandle, timeout, cbFun))

        origTransportDomain = transportDomain
        origTransportAddress = transportAddress

        # 4.1.1.4 & 4.1.1.5
        try:
            (transportDomain,
             transportAddress,
             outgoingMessage) = mpHandler.prepareOutgoingMessage(
                snmpEngine, origTransportDomain, origTransportAddress,
                messageProcessingModel, securityModel, securityName,
                securityLevel, contextEngineId, contextName,
                pduVersion, PDU, expectResponse, sendPduHandle
            )

            debug.logger & debug.FLAG_DSP and debug.logger(
                'sendPdu: MP succeeded')

        except PySnmpError:
            if expectResponse:
                self._cache.pop(sendPduHandle)
                self.releaseStateInformation(snmpEngine, sendPduHandle, messageProcessingModel)

            raise

        # 4.1.1.6
        if snmpEngine.transportDispatcher is None:
            if expectResponse:
                self._cache.pop(sendPduHandle)

            raise error.PySnmpError('Transport dispatcher not set')

        snmpEngine.observer.storeExecutionContext(
            snmpEngine, 'rfc3412.sendPdu',
            dict(transportDomain=transportDomain,
                 transportAddress=transportAddress,
                 outgoingMessage=outgoingMessage,
                 messageProcessingModel=messageProcessingModel,
                 securityModel=securityModel,
                 securityName=securityName,
                 securityLevel=securityLevel,
                 contextEngineId=contextEngineId,
                 contextName=contextName,
                 pdu=PDU)
        )

        try:
            snmpEngine.transportDispatcher.sendMessage(
                outgoingMessage, transportDomain, transportAddress)

        except PySnmpError:
            if expectResponse:
                self._cache.pop(sendPduHandle)
            raise

        snmpEngine.observer.clearExecutionContext(
            snmpEngine, 'rfc3412.sendPdu')

        # Update cache with orignal req params (used for retrying)
        if expectResponse:
            self._cache.update(
                sendPduHandle,
                transportDomain=origTransportDomain,
                transportAddress=origTransportAddress,
                securityModel=securityModel,
                securityName=securityName,
                securityLevel=securityLevel,
                contextEngineId=contextEngineId,
                contextName=contextName,
                pduVersion=pduVersion,
                PDU=PDU
            )

        return sendPduHandle
637561
def data96_send(self, type, len, data, force_mavlink1=False):
                '''
                

                '''
                return self.send(self.data96_encode(type, len, data), force_mavlink1=force_mavlink1)
1211398
private void sendNextPayload() {
		singleThreadExecutor.execute(new Runnable() {
			@Override
			public void run() {
				try {
					sendNextPayloadSync();
				} catch (Exception e) {
					ApptentiveLog.e(e, "Exception while trying to send next payload");
					logException(e);
				}
			}
		});
	}
365172
async def send(self, metric):
        
        message = json.dumps(metric).encode('utf-8')
        await self.loop.create_datagram_endpoint(
            lambda: UDPClientProtocol(message),
            remote_addr=(self.ip, self.port))
377361
def send_wpa_enc(self, data, iv, seqnum, dest, mic_key,
                     key_idx=0, additionnal_flag=["from-DS"],
                     encrypt_key=None):
        

        if encrypt_key is None:
            encrypt_key = self.tk

        rep = RadioTap()
        rep /= Dot11(
            addr1=dest,
            addr2=self.mac,
            addr3=self.mac,
            FCfield="+".join(['protected'] + additionnal_flag),
            SC=(next(self.seq_num) << 4),
            subtype=0,
            type="Data",
        )

        # Assume packet is send by our AP -> use self.mac as source

        # Encapsule in TKIP with MIC Michael and ICV
        data_to_enc = build_MIC_ICV(raw(data), mic_key, self.mac, dest)

        # Header TKIP + payload
        rep /= Raw(build_TKIP_payload(data_to_enc, iv, self.mac, encrypt_key))

        self.send(rep)
        return rep
995457
def indication(self, pdu):
        """"""
        if _debug: StreamToPacket._debug("indication %r", pdu)

        # hack it up into chunks
        for packet in self.packetize(pdu, self.downstreamBuffer):
            self.request(packet)