Sends a datagram over the datagram socket.
198053
protected void sendDatagram (UpstreamMessage msg)
        throws IOException
    {
        // reset the stream and write our connection id and hash placeholder
        _bout.reset();
        _uout.writeInt(_client.getConnectionId());
        _uout.writeLong(0L);

        // write the datagram through the sequencer
        _sequencer.writeDatagram(msg);

        // flip the buffer and make sure it's not too long
        ByteBuffer buf = _bout.flip();
        int size = buf.remaining();
        if (size > Client.MAX_DATAGRAM_SIZE) {
            log.warning("Dropping oversized datagram", "size", size, "msg", msg);
            return;
        }

        // compute the hash
        buf.position(12);
        _digest.update(buf);
        byte[] hash = _digest.digest(_secret);

        // insert the first 64 bits of the hash
        buf.position(4);
        buf.put(hash, 0, 8).rewind();

        // send the datagram
        writeDatagram(buf);

        // notify the tracker
        _client.getMessageTracker().messageSent(true, size, msg);
    }
1001367
def send(_dict, addr):
        
        # TODO(rbtz@): IPv6 support
        udp_sock = socket(AF_INET, SOCK_DGRAM)
        # TODO(rbtz@): Add batch support
        for item in _dict.items():
            udp_sock.sendto(":".join(item).encode('utf-8'), addr)
319175
@Override
	protected void sendOutput(String metricLine) throws IOException {
		DatagramPacket packet;
		byte[] data;

		data = metricLine.getBytes("UTF-8");
		packet = new DatagramPacket(data, 0, data.length, this.address);

		this.dgSocket.send(packet);
	}
378239
def send(self, packet, retry=True):
        """"""
        if not self.keep_listening:
            self.log('is down.')
            return

        try:
            # (because the IRC server sees this link as 1 connection no matter how many nodes use it, it wont send enough copies of the packet back)
            # for each node listening to this link object locally
            for mac_addr, recv_queue in self.inq.items():
                recv_queue.put(packet) # put the packet directly in their in queue
            # then send it down the wire to the IRC channel
            self.net_socket.send(('PRIVMSG %s :%s\r\n' % (self.channel, packet.decode())).encode('utf-8'))
        except Exception as e:
            self.log("Link failed to send packet over socket %s" % e)
            sleep(0.2)
            if retry:
                self.send(packet, retry=False)
821000
def SendDatagram(self, Text):
        
        self.Application._Alter('DATAGRAM', '%s %s' % (self.Handle, tounicode(Text)))
1175886
def _send(self, data):
        
        # check link
        if self.__sock is None:
            self.__debug_msg('call _send on close socket')
            return None
        # send
        data_l = len(data)
        try:
            send_l = self.__sock.send(data)
        except socket.error:
            send_l = None
        # handle send error
        if (send_l is None) or (send_l != data_l):
            self.__last_error = const.MB_SEND_ERR
            self.__debug_msg('_send error')
            self.close()
            return None
        else:
            return send_l
961733
public void sendMessage(String message){

		byte[] datagramData = message.getBytes();
		datagramPacket.setData(datagramData);

		try {
			datagramSocket.send(datagramPacket);
		} catch (IOException e) {
			Log.e(TAG, "Failed to send datagram log " + e);
		}
	}
955697
def _send(self, ip, port, data):
        
        return self._listen_socket.sendto(data, (ip, port))
526114
def receive_datagram(self):
        
        logger.debug("Start receiver Thread")
        while not self.stopped.isSet():
            self._socket.settimeout(0.1)
            try:
                datagram, addr = self._socket.recvfrom(1152)
            except socket.timeout:  # pragma: no cover
                continue
            except Exception as e:  # pragma: no cover
                if self._cb_ignore_read_exception is not None and isinstance(self._cb_ignore_read_exception, collections.Callable):
                    if self._cb_ignore_read_exception(e, self):
                        continue
                return
            else:  # pragma: no cover
                if len(datagram) == 0:
                    logger.debug("Exiting receiver Thread due to orderly shutdown on server end")
                    return

            serializer = Serializer()

            try:
                host, port = addr
            except ValueError:
                host, port, tmp1, tmp2 = addr

            source = (host, port)

            message = serializer.deserialize(datagram, source)

            if isinstance(message, Response):
                logger.debug("receive_datagram - " + str(message))
                transaction, send_ack = self._messageLayer.receive_response(message)
                if transaction is None:  # pragma: no cover
                    continue
                self._wait_for_retransmit_thread(transaction)
                if send_ack:
                    self._send_ack(transaction)
                self._blockLayer.receive_response(transaction)
                if transaction.block_transfer:
                    self._send_block_request(transaction)
                    continue
                elif transaction is None:  # pragma: no cover
                    self._send_rst(transaction)
                    return
                self._observeLayer.receive_response(transaction)
                if transaction.notification:  # pragma: no cover
                    ack = Message()
                    ack.type = defines.Types['ACK']
                    ack = self._messageLayer.send_empty(transaction, transaction.response, ack)
                    self.send_datagram(ack)
                    self._callback(transaction.response)
                else:
                    self._callback(transaction.response)
            elif isinstance(message, Message):
                self._messageLayer.receive_empty(message)

        logger.debug("Exiting receiver Thread due to request")
48729
def send_packet(self, packet):
        """"""
        data = json.dumps(packet)
        byte = data.encode('utf-8')
        self.udp_socket.sendto(byte, (self._host, self._udp_port))
161989
public void sendData(byte[] data) throws ResponseException {
        if(con.isClosed()) return;

        Socket socket = null;
        try {
            socket = conHandler.createDataSocket();
            dataConnections.add(socket);
            OutputStream out = socket.getOutputStream();

            Utils.write(out, data, data.length, conHandler.isAsciiMode());
            bytesTransferred += data.length;

            out.flush();
            Utils.closeQuietly(out);
            Utils.closeQuietly(socket);
        } catch(SocketException ex) {
            throw new ResponseException(426, "Transfer aborted");
        } catch(IOException ex) {
            throw new ResponseException(425, "An error occurred while transferring the data");
        } finally {
            onUpdate();
            if(socket != null) dataConnections.remove(socket);
        }
    }
1237150
def send(self, data):
        """"""
        self._send_data(int_to_hex(len(data)))

        self._send_data(data)
1308206
def send_data(self):
        """"""
        if not self.connection._sock:
            raise err.InterfaceError("(0, '')")
        conn = self.connection

        try:
            with open(self.filename, 'rb') as open_file:
                packet_size = min(conn.max_allowed_packet, 16*1024)  # 16KB is efficient enough
                while True:
                    chunk = open_file.read(packet_size)
                    if not chunk:
                        break
                    conn.write_packet(chunk)
        except IOError:
            raise err.OperationalError(1017, "Can't find file '{0}'".format(self.filename))
        finally:
            # send the empty packet to signify we are done sending data
            conn.write_packet(b'')
50371
public synchronized void writeDatagram (Message datagram)
        throws IOException
    {
        // first write the sequence and acknowledge numbers
        _uout.writeInt(++_lastNumber);
        _uout.writeInt(_lastReceived);

        // make sure the mapped sets are clear
        Set<Class<?>> mappedClasses = _uout.getMappedClasses();
        mappedClasses.clear();
        Set<String> mappedInterns = _uout.getMappedInterns();
        mappedInterns.clear();

        // write the object
        _uout.writeObject(datagram);

        // if we wrote any class mappings, we will keep them in the send record
        if (mappedClasses.isEmpty()) {
            mappedClasses = null;
        } else {
            _uout.setMappedClasses(new HashSet<Class<?>>());

        }

        // likewise with the intern mappings
        if (mappedInterns.isEmpty()) {
            mappedInterns = null;
        } else {
            _uout.setMappedInterns(new HashSet<String>());

        }

        // record the transmission
        _sendrecs.add(new SendRecord(_lastNumber, mappedClasses, mappedInterns));
    }
865301
def send(x, inter=0, loop=0, count=None, verbose=None, realtime=None, *args, **kargs):
    """"""
    __gen_send(conf.L3socket(*args, **kargs), x, inter=inter, loop=loop, count=count,verbose=verbose, realtime=realtime)
99004
def _send_receive(self, payload):
        
        s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        s.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
        s.settimeout(self.connection_timeout)
        s.connect((self.address, self.port))
        s.send(payload)
        data = s.recv(1024)
        s.close()
        return data
891281
def data32_send(self, type, len, data, force_mavlink1=False):
                '''
                

                '''
                return self.send(self.data32_encode(type, len, data), force_mavlink1=force_mavlink1)