Send data to a remote host via the TURN server.
540469
async def send_data(self, data, addr):
        
        channel = self.peer_to_channel.get(addr)
        if channel is None:
            channel = self.channel_number
            self.channel_number += 1
            self.channel_to_peer[channel] = addr
            self.peer_to_channel[addr] = channel

            # bind channel
            await self.channel_bind(channel, addr)

        header = struct.pack('!HH', channel, len(data))
        self._send(header + data)
1287871
def listen(self, *, host, port, override=False, forever=False, **kwargs):
        
        if override:
            argv = dict(enumerate(sys.argv))
            host = argv.get(1, host)
            port = int(argv.get(2, port))
        server = self.loop.create_server(
            self.__handler.fork, host, port, **kwargs)
        server = self.loop.run_until_complete(server)
        self.log('info',
            'Start listening host="{host}" port="{port}"'.
            format(host=host, port=port))
        if forever:
            try:
                self.loop.run_forever()
            except KeyboardInterrupt:
                pass
        return server
1061577
def send(x, inter=0, loop=0, count=None,
         verbose=None, realtime=None,
         return_packets=False, socket=None, *args, **kargs):
    """"""
    need_closing = socket is None
    socket = socket or conf.L3socket(*args, **kargs)
    results = __gen_send(socket, x, inter=inter, loop=loop,
                         count=count, verbose=verbose,
                         realtime=realtime, return_packets=return_packets)
    if need_closing:
        socket.close()
    return results
783420
def send(self, data: bytes = b""):
        
        self.input.extend(data)
        self._process()
138717
def send_cmd_recv_rsp(self, target, data, timeout):
        
        return super(Device, self).send_cmd_recv_rsp(target, data, timeout)
218794
def sendto(self, data, addr=None):
        
        if not isinstance(data, (bytes, bytearray, memoryview)):
            raise TypeError("data: expecting a bytes-like instance, got {!r}"
                                .format(type(data).__name__))
        self._check_status()
        if not self._writable:
            raise TransportError('transport is not writable')
        try:
            self._handle.send(addr, data, self._on_send_complete)
        except pyuv.error.UVError as e:
            error = TransportError.from_errno(e.args[0])
            # Try to discern between permanent and transient errors. Permanent
            # errors close the transport. This list is very likely not complete.
            if error.errno != pyuv.errno.UV_EBADF:
                raise error
            self._error = error
            self.abort()
        self._write_buffer_size += 1
        self._maybe_pause_protocol()
272346
def transfercmd(cmd, rest_offset = nil) # :nodoc:
      if @passive
        host, port = makepasv
        conn = open_socket(host, port)
        if @resume and rest_offset
          resp = sendcmd("REST " + rest_offset.to_s)
          if resp[0] != ?3
            raise FTPReplyError, resp
          end
        end
        resp = sendcmd(cmd)
        # skip 2XX for some ftp servers
        resp = getresp if resp[0] == ?2
        if resp[0] != ?1
          raise FTPReplyError, resp
        end
      else
        sock = makeport
        if @resume and rest_offset
          resp = sendcmd("REST " + rest_offset.to_s)
          if resp[0] != ?3
            raise FTPReplyError, resp
          end
        end
        resp = sendcmd(cmd)
        # skip 2XX for some ftp servers
        resp = getresp if resp[0] == ?2
        if resp[0] != ?1
          raise FTPReplyError, resp
        end
        conn = BufferedSocket.new(sock.accept)
        conn.read_timeout = @read_timeout
        sock.shutdown(Socket::SHUT_WR) rescue nil
        sock.read rescue nil
        sock.close
      end
      return conn
    end
829279
def send_keys(self, keyserver, *keyids):
        """"""
        result = self._result_map['list'](self)
        log.debug('send_keys: %r', keyids)
        data = _util._make_binary_stream("", self._encoding)
        args = ['--keyserver', keyserver, '--send-keys']
        args.extend(keyids)
        self._handle_io(args, data, result, binary=True)
        log.debug('send_keys result: %r', result.__dict__)
        data.close()
        return result
199060
def send(self, commands):
        ""
        if not commands.endswith("\n"):
            commands += "\n"
        self.sock.send(commands)
897666
def send_data_on_udp(ip_address, port, data):
    """"""
    sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
    try:
        sock.sendto(data.encode('utf-8'), (ip_address, port))
    except:
        LOGGER.exception('Failed to send trace to X-Ray Daemon')
    finally:
        sock.close()
26062
def send(self, data):
        
        try:
            if not data:
                raise RconError('no command supplied')
            with self.lock:
                self.socket.send(self._rconsendstring.format(self.password, data))
        except socket.error, e:
            raise RconError(e.message, e)
        else:
            timeout = self._timeout
            command = data.split(' ')[0]
            if command in self._long_commands_timeout:
                timeout = self._long_commands_timeout[command]
            return self.recvall(timeout=timeout)
1086936
def send_request(self, request):
        """"""
        # throttle the number of requests to each host
        self.aggregate.wait_for_host(self.urlparts[1])
        kwargs = self.get_request_kwargs()
        kwargs["allow_redirects"] = False
        self._send_request(request, **kwargs)
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
1322569
def send(self, data):
        
        _vv and IOLOG.debug('%r.send(%r..)', self, repr(data)[:100])
        self.context.send(Message.pickled(data, handle=self.dst_handle))
623215
def send(self, data):
        
        try:
            proc = subprocess.Popen(self.cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
        except OSError as exc:
            raise URLError("Calling %r failed (%s)!" % (' '.join(self.cmd), exc))
        else:
            stdout, stderr = proc.communicate(data)
            if proc.returncode:
                raise URLError("Calling %r failed with RC=%d!\n%s" % (
                   ' '.join(self.cmd), proc.returncode, stderr,
                ))
            yield stdout
133114
def send_hostinfo(config):
    '''
    
    '''
    info = all_host_infos()
    logger.debug("Sending host information: " + str(info))
    post_data = [("Config", json.dumps(info)),
                 ("Action", "get_config"),
                 ("UUID", config.get("Server", "uuid")),
                 ("Address", ipaddress()),
                 ("Secret", config.get("Server", "secret"))
                 ]

    send_post(config, "/machines/", post_data)
1268761
def send_command(self, data, read_delay=None):
        """"""
        self._write(data)
        if read_delay:
            time.sleep(read_delay)
        return self._read()