Sends commands to this hypervisor.

        :param command: a uBridge hypervisor command

        :returns: results as a list
4927
def send(self, command):
        

        # uBridge responses are of the form:
        #   1xx yyyyyy\r\n
        #   1xx yyyyyy\r\n
        #   ...
        #   100-yyyy\r\n
        # or
        #   2xx-yyyy\r\n
        #
        # Where 1xx is a code from 100-199 for a success or 200-299 for an error
        # The result might be multiple lines and might be less than the buffer size
        # but still have more data. The only thing we know for sure is the last line
        # will begin with '100-' or a '2xx-' and end with '\r\n'

        if self._writer is None or self._reader is None:
            raise UbridgeError("Not connected")

        try:
            command = command.strip() + '\n'
            log.debug("sending {}".format(command))
            self._writer.write(command.encode())
            yield from self._writer.drain()
        except OSError as e:
            raise UbridgeError("Lost communication with {host}:{port} :{error}, Dynamips process running: {run}"
                               .format(host=self._host, port=self._port, error=e, run=self.is_running()))

        # Now retrieve the result
        data = []
        buf = ''
        retries = 0
        max_retries = 10
        while True:
            try:
                try:
                    chunk = yield from self._reader.read(1024)
                except asyncio.CancelledError:
                    # task has been canceled but continue to read
                    # any remaining data sent by the hypervisor
                    continue
                except ConnectionResetError as e:
                    # Sometimes WinError 64 (ERROR_NETNAME_DELETED) is returned here on Windows.
                    # These happen if connection reset is received before IOCP could complete
                    # a previous operation. Ignore and try again....
                    log.warning("Connection reset received while reading uBridge response: {}".format(e))
                    continue
                if not chunk:
                    if retries > max_retries:
                        raise UbridgeError("No data returned from {host}:{port}, uBridge process running: {run}"
                                            .format(host=self._host, port=self._port, run=self.is_running()))
                    else:
                        retries += 1
                        yield from asyncio.sleep(0.1)
                        continue
                retries = 0
                buf += chunk.decode("utf-8")
            except OSError as e:
                raise UbridgeError("Lost communication with {host}:{port} :{error}, uBridge process running: {run}"
                                   .format(host=self._host, port=self._port, error=e, run=self.is_running()))

            # If the buffer doesn't end in '\n' then we can't be done
            try:
                if buf[-1] != '\n':
                    continue
            except IndexError:
                raise UbridgeError("Could not communicate with {host}:{port}, uBridge process running: {run}"
                                   .format(host=self._host, port=self._port, run=self.is_running()))

            data += buf.split('\r\n')
            if data[-1] == '':
                data.pop()
            buf = ''

            # Does it contain an error code?
            if self.error_re.search(data[-1]):
                raise UbridgeError(data[-1][4:])

            # Or does the last line begin with '100-'? Then we are done!
            if data[-1][:4] == '100-':
                data[-1] = data[-1][4:]
                if data[-1] == 'OK':
                    data.pop()
                break

        # Remove success responses codes
        for index in range(len(data)):
            if self.success_re.search(data[index]):
                data[index] = data[index][4:]

        log.debug("returned result {}".format(data))
        return data
297485
def sendline(command):
    '''
    
    '''
    if ping() is False:
        init()
    out, _ = DETAILS[_worker_name()].sendline(command)
    return out
878815
async def _send_command(self, command):
        
        send_message = ""

        for i in command:
            send_message += chr(i)
        result = None
        for data in send_message:
            try:
                result = await self.write(data)
            except():
                if self.log_output:
                    logging.exception('cannot send command')
                else:
                    print('cannot send command')
        return result
895447
def send(self, command):
        
        # The POLL command requests data from the last-seen fixes on all active GPS devices.
        # Devices must previously have been activated by ?WATCH to be pollable.
        try:
            self.streamSock.send(bytes(command, encoding='utf-8'))
        except TypeError:
            self.streamSock.send(command)  # 2.7 chokes on 'bytes' and 'encoding='
        except (OSError, IOError) as error:  # MOE, LEAVE THIS ALONE!...for now.
            sys.stderr.write('\nGPS3 send command fail with {}\n'.format(error))
650318
def send_command_return_multilines(self, obj, command, *arguments):
        
        return self._perform_command('{}/{}'.format(self.session_url, obj.ref), command,
                                     OperReturnType.multiline_output, *arguments).json()
431533
def execute(self, command, timeout=1):
        
        self.send(command)
        return self.read_untill(timeout)
1351076
def command_x(self, x, to=None):
        
        if to is None:
            ActionChains(self.driver) \
                .send_keys([Keys.COMMAND, x, Keys.COMMAND]) \
                .perform()
        else:
            self.send_keys(to, [Keys.COMMAND, x, Keys.COMMAND])
759083
public boolean sendCommand(String command) {
        if (writer != null) {
            try {
                logger.info("Sending command " + command + " to remote host " + remoteHost);
                writer.write(command);
                writer.write('\r');
                writer.flush();
            } catch (IOException e) {
                logger.fatal("Error while sending command " + command + " to remote host " + remoteHost, e);
                return false;
            }
            return true;
        } else {
            return false;
        }
    }
340632
def _send_command_list(self, commands):
        """"""
        output = ""
        for command in commands:
            output += self.device.send_command(
                command, strip_prompt=False, strip_command=False
            )
        return output
1096475
def linkify_command_list_with_commands(self, commands, prop):
        
        for i in self:
            if not hasattr(i, prop):
                continue

            commands_list = strip_and_uniq(getattr(i, prop, ''))
            cmds_list = []
            for command in commands_list:
                if not command:
                    continue

                cmds_list.append(self.create_commandcall(i, commands, command))
            setattr(i, prop, cmds_list)
1070107
def send(self, command, sender, target, args, kwargs):
        
        command = get_command(command)
        data = {'command': command.__name__,
                'id': create_aid(),
                'sender': actor_identity(sender),
                'target': actor_identity(target),
                'args': args if args is not None else (),
                'kwargs': kwargs if kwargs is not None else {}}

        waiter = self._loop.create_future()
        ack = None
        if command.ack:
            ack = create_aid()
            data['ack'] = ack
            self.pending_responses[ack] = waiter

        try:
            self.write(data)
        except Exception as exc:
            waiter.set_exception(exc)
            if ack:
                self.pending_responses.pop(ack, None)
        else:
            if not ack:
                waiter.set_result(None)
        return waiter
153866
def send_packed_command(self, command):
        ""
        if not self._sock:
            self.connect()
        try:
            if isinstance(command, str):
                command = [command]
            for item in command:
                self._sock.sendall(item)
        except socket.timeout:
            self.disconnect()
            raise TimeoutError("Timeout writing to socket")
        except socket.error:
            e = sys.exc_info()[1]
            self.disconnect()
            if len(e.args) == 1:
                errno, errmsg = 'UNKNOWN', e.args[0]
            else:
                errno = e.args[0]
                errmsg = e.args[1]
            raise ConnectionError("Error %s while writing to socket. %s." %
                                  (errno, errmsg))
        except:  # noqa: E722
            self.disconnect()
            raise
1122364
def sendCommand(self, command):
        
        command_data = [ord(x) for x in buffer(command)]
        self.hid.write(command_data)
        response_data = ''.join(chr(x) for x in self.hid.read(64))
        response = command.RESPONSE.from_buffer_copy(response_data)
        if response.status != 0:
            raise CommandException(response.status)
        return response
1090467
@Override
    public boolean sendCommand(String command) {
        try {
            sendCommand2(command);
        } catch (Exception ex) {
            logger.error("Could not run command " + command, ex);
            return false;
        }
        return true;
    }
1234491
def command(self, command, arg=None):
        
        sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

        try:
            sock.connect((self.host, self.port))
            payload = {"command": command}
            if arg is not None:
                # Parameter must be converted to basestring (no int)
                payload.update({'parameter': unicode(arg)})

            sock.send(json.dumps(payload))
            received = self._receive(sock)
        finally:
            sock.shutdown(socket.SHUT_RDWR)
            sock.close()

        return json.loads(received[:-1])
1282691
def _simple_command(self, command, arg=None, **kwargs):
    """"""
    self._protocol.send_command(command, arg)
    return self._protocol.handle_simple_responses(**kwargs)
173607
def _send(self, command):
        
        command = command.encode('utf-8')
        log.debug('>> ' + command)
        self.conn.oqueue.put(command)