Send the specified value to the statsd daemon via UDP without a
    direct socket connection.

    :param str value: The properly formatted statsd counter value
760682
def _send(key, value, metric_type):
    
    if STATSD_PREFIX:
        key = '.'.join([STATSD_PREFIX, key])
    try:
        STATSD_SOCKET.sendto('{0}:{1}|{2}'.format(key,
                                                  value,
                                                  metric_type).encode(),
                             STATSD_ADDR)
    except socket.error:
        LOGGER.exception(SOCKET_ERROR)
1210660
def send_udp_message():
    
    host = os.getenv(
        "UDP_SEND_TO_HOST",
        "0.0.0.0").strip().lstrip()
    port = int(os.getenv(
        "UDP_SEND_TO_PORT",
        "17000").strip().lstrip())

    need_response = os.getenv("NEED_RESPONSE", "0") == "1"

    msg = os.getenv(
            "MSG",
            "testing UDP msg time={} - {}".format(
                datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"),
                uuid.uuid4()))

    server_address = (host, port)

    client = socket.socket(socket.AF_INET,
                           socket.SOCK_DGRAM)

    print(("sending UDP: "
           "address={} msg={}")
          .format(server_address,
                  msg))
    client.sendto(msg.encode(), server_address)
    if need_response:
        data = client.recv(1024).decode()
        print(data)
    client.close()
100263
def update(self, value=None):
        ''

        if value is not None and value is not UnknownLength:
            if (self.maxval is not UnknownLength
                    and not 0 <= value <= self.maxval
                    and not value < self.currval):

                raise ValueError('Value out of range')

            self.currval = value

        if self.start_time is None:
            self.start()
            self.update(value)
        if not self._need_update():
            return

        if self.redirect_stderr and sys.stderr.tell():
            self.fd.write('\r' + ' ' * self.term_width + '\r')
            self._stderr.write(sys.stderr.getvalue())
            self._stderr.flush()
            sys.stderr = StringIO()

        if self.redirect_stdout and sys.stdout.tell():
            self.fd.write('\r' + ' ' * self.term_width + '\r')
            self._stdout.write(sys.stdout.getvalue())
            self._stdout.flush()
            sys.stdout = StringIO()

        now = time.time()
        self.seconds_elapsed = now - self.start_time
        self.next_update = self.currval + self.update_interval
        self.fd.write('\r' + self._format_line())
        self.last_update_time = now
1149494
def send(self, stat, value, rate=1):
        """"""
        if rate < 1:
            value = "%s|@%s" % (value, rate)
        return super().send(stat, value, rate)
880244
def set_parameter(connection, parameter, value, verbose=False):
    
    value = str(value)
    try:
        if not connection.set_parameter(parameter, value):
            raise ValueError("invalid parameter or value")
    except (AttributeError, ValueError) as exc:
        warnings.warn(
            'failed to set {}={!r}: {}'.format(parameter, value, str(exc)),
            io_nds2.NDSWarning)
    else:
        print_verbose(
            '    [{}] set {}={!r}'.format(
                connection.get_host(), parameter, value),
            verbose=verbose,
        )
51336
def _send(self, value, mode):
        """"""
        # Wait, if compatibility mode is enabled
        if self.compat_mode:
            self._wait()

        # Choose instruction or data mode
        GPIO.output(self.pins.rs, mode)

        # If the RW pin is used, set it to low in order to write.
        if self.pins.rw is not None:
            GPIO.output(self.pins.rw, 0)

        # Write data out in chunks of 4 or 8 bit
        if self.data_bus_mode == c.LCD_8BITMODE:
            self._write8bits(value)
        else:
            self._write4bits(value >> 4)
            self._write4bits(value)

        # Record the time for the tail-end of the last send event
        if self.compat_mode:
            self.last_send_event = now()
1255295
def write(self, value):
        
        if self.mode is UNAVAILABLE:
            raise IOError("{0} can not be used through Firmata".format(self))
        if self.mode is INPUT:
            raise IOError("{0} is set up as an INPUT and can therefore not be written to"
                          .format(self))
        if value is not self.value:
            self.value = value
            if self.mode is OUTPUT:
                if self.port:
                    self.port.write()
                else:
                    msg = bytearray([DIGITAL_MESSAGE, self.pin_number, value])
                    self.board.sp.write(msg)
            elif self.mode is PWM:
                value = int(round(value * 255))
                msg = bytearray([ANALOG_MESSAGE + self.pin_number, value % 128, value >> 7])
                self.board.sp.write(msg)
            elif self.mode is SERVO:
                value = int(value)
                msg = bytearray([ANALOG_MESSAGE + self.pin_number, value % 128, value >> 7])
                self.board.sp.write(msg)
144574
function(str, sendUpdatedEvt) {
      inputEx.TimeField.superclass.setValue.call(this, str.split(':'), sendUpdatedEvt);
   }
200141
def set_id(self, value):
        
        if value is None:
            self.__id = value
        if not isinstance(value, str):
            raise TypeError("ID must be set to a String")
        else:
            self.__id = value
726817
def sendto(self, data, addr):
        
        asyncio.ensure_future(self.__inner_protocol.send_data(data, addr))
931333
def timing(self, stats, value):
        
        self.update_stats(stats, value, self.SC_TIMING)
12850
def publish(self, value):
        
        value = super(Float, self).publish(value)
        if isinstance(value, int):
            value = float(value)
        return value
1337279
def _send(self, value, mode):
        """"""

        # Assemble the parameters sent to the pigpio script
        params = [mode]
        params.extend([(value >> i) & 0x01 for i in range(8)])
        # Switch off pigpio's exceptions, so that we get the return codes
        pigpio.exceptions = False
        while True:
            ret = self.pi.run_script(self._writescript, params)
            if ret >= 0:
                break
            elif ret != pigpio.PI_SCRIPT_NOT_READY:
                raise pigpio.error(pigpio.error_text(ret))
            # If pigpio script is not ready, sleep and try again
            c.usleep(1)
        # Switch on pigpio's exceptions
        pigpio.exceptions = True
540053
def send(self, path, value, metric_type):
        
        msg = self._msg_format.format(
            path=self._build_path(path, metric_type),
            value=value,
            metric_type=metric_type)

        LOGGER.debug('Sending %s to %s:%s', msg.encode('ascii'),
                     self._host, self._port)

        try:
            if self._tcp:
                if self._sock.closed():
                    return
                return self._sock.write(msg.encode('ascii'))

            self._sock.sendto(msg.encode('ascii'), (self._host, self._port))
        except iostream.StreamClosedError as error:  # pragma: nocover
            LOGGER.warning('Error sending TCP statsd metric: %s', error)
        except (OSError, socket.error) as error:  # pragma: nocover
            LOGGER.exception('Error sending statsd metric: %s', error)
10542
def send_command():
    

    def verbose(msg):
        """
        print output if verbose is set.
        """
        if options.verbose:
            print(msg)

    options = command_parser()
    msg = json.dumps(vars(options)).encode("utf-8")
    if len(msg) > MAX_SIZE:
        verbose("Message length too long, max length (%s)" % MAX_SIZE)

    # find all likely socket addresses
    uds_list = glob.glob("{}.[0-9]*".format(SERVER_ADDRESS))

    verbose('message "%s"' % msg)
    for uds in uds_list:
        # Create a UDS socket
        sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)

        # Connect the socket to the port where the server is listening
        verbose("connecting to %s" % uds)
        try:
            sock.connect(uds)
        except socket.error:
            # this is a stale socket so delete it
            verbose("stale socket deleting")
            try:
                os.unlink(uds)
            except OSError:
                pass
            continue
        try:
            # Send data
            verbose("sending")
            sock.sendall(msg)
        finally:
            verbose("closing socket")
            sock.close()
539499
def thread(self, value: str):
        
        if value is not None and not isinstance(value, str):
            raise TypeError("'thread' MUST be a string")
        self._thread = value
235258
public static int send(SocketBase s, String str, int flags)
    {
        byte[] data = str.getBytes(CHARSET);
        return send(s, data, data.length, flags);
    }