Receive the next remote message.
pend(don) Need to keep retrying if timeout as some firewalls won't wait forever.
@param strCommand Command to perform remotely.
@return boolean success.
484655
public BaseMessage receiveRemoteMessage() throws RemoteException
    {
        BaseTransport transport = this.createProxyTransport(RECEIVE_REMOTE_MESSAGE);
        Object strReturn = transport.sendMessageAndGetReply();
        Object objReturn = transport.convertReturnObject(strReturn);
        return (BaseMessage)objReturn;
    }
188050
public RemoteTable getRemoteTable(String strRecordName) throws RemoteException
    {
        BaseTransport transport = this.createProxyTransport(GET_REMOTE_TABLE);
        transport.addParam(NAME, strRecordName);
        String strTableID = (String)transport.sendMessageAndGetReply();
        // See if I have this one already
        TableProxy tableProxy = (TableProxy)this.getChildList().get(strTableID);
        if (tableProxy == null)
            tableProxy = new TableProxy(this, strTableID); // This will add it to my list
        return tableProxy;
    }
1196306
static void remote_exec( final AutoBuffer ab ) {
    long lo = ab.get8(0), hi = ab.get8(8); // for dbg
    final int task = ab.getTask();
    final int flag = ab.getFlag();
    assert flag==CLIENT_UDP_SEND || flag==CLIENT_TCP_SEND; // Client-side send
    // Atomically record an instance of this task, one-time-only replacing a
    // null with an RPCCall, a placeholder while we work on a proper response -
    // and it serves to let us discard dup UDP requests.
    RPCCall old = ab._h2o.has_task(task);
    // This is a UDP packet requesting an answer back for a request sent via
    // TCP but the UDP packet has arrived ahead of the TCP.  Just drop the UDP
    // and wait for the TCP to appear.
    if( old == null && flag == CLIENT_TCP_SEND ) {
      if(ab.hasTCP())TimeLine.printMyTimeLine();
      assert !ab.hasTCP():"ERROR: got tcp with existing task #, FROM " + ab._h2o.toString() + " AB: " +  UDP.printx16(lo,hi);      // All the resends should be UDP only
      // DROP PACKET
    } else if( old == null ) {  // New task?
      RPCCall rpc;
      try {
        // Read the DTask Right Now.  If we are the TCPReceiver thread, then we
        // are reading in that thread... and thus TCP reads are single-threaded.
        rpc = new RPCCall(ab.get(water.DTask.class),ab._h2o,task);
      } catch( AutoBuffer.AutoBufferException e ) {
        // Here we assume it's a TCP fail on read - and ignore the remote_exec
        // request.  The caller will send it again.  NOTE: this case is
        // indistinguishable from a broken short-writer/long-reader bug, except
        // that we'll re-send endlessly and fail endlessly.
        Log.info("Network congestion OR short-writer/long-reader: TCP "+e._ioe.getMessage()+",  AB="+ab+", ignoring partial send");
        ab.drainClose();
        return;
      }
      RPCCall rpc2 = ab._h2o.record_task(rpc);
      if( rpc2==null ) {        // Atomically insert (to avoid double-work)
        if( (rpc._dt instanceof DRemoteTask || rpc._dt instanceof MRTask2) && rpc._dt.logVerbose() )
          Log.debug("Start remote task#"+task+" "+rpc._dt.getClass()+" from "+ab._h2o);
        H2O.submitTask(rpc);    // And execute!
      } else {                  // Else lost the task-insertion race
        if(ab.hasTCP())TimeLine.printMyTimeLine();
        assert !ab.hasTCP():"ERROR: got tcp with existing task #, FROM " + ab._h2o.toString() + " AB: " +  UDP.printx16(lo,hi); // All the resends should be UDP only
        // DROP PACKET
      }
    } else if( !old._computedAndReplied) {
      ++old._callCnt;
      // This packet has not been fully computed.  Hence it's still a work-in-
      // progress locally.  We have no answer to reply but we do not want to
      // re-offer the packet for repeated work.  Just ignore the packet.
      if(ab.hasTCP())TimeLine.printMyTimeLine();
      assert !ab.hasTCP():"ERROR: got tcp resend with existing in-progress task #, FROM " + ab._h2o.toString() + " AB: " +  UDP.printx16(lo,hi); // All the resends should be UDP only
      // DROP PACKET
    } else {
      ++old._ackResendCnt;
      if(old._ackResendCnt % 50 == 0)
        Log.err("Possibly broken network, can not send ack through, got " + old._ackResendCnt + " resends.");
      // This is an old re-send of the same thing we've answered to before.
      // Send back the same old answer ACK.  If we sent via TCP before, then
      // we know the answer got there so just send a control-ACK back.  If we
      // sent via UDP, resend the whole answer.
      if(ab.hasTCP())TimeLine.printMyTimeLine();
      assert !ab.hasTCP():"ERROR: got tcp with existing task #, FROM " + ab._h2o.toString() + " AB: " +  UDP.printx16(lo,hi); // All the resends should be UDP only
      old.resend_ack();
    }
    ab.close();
  }
815147
public int getRemoteAddress(byte []buffer, int offset, int length)
  {
    String name = getRemoteHost();
    int len = name.length();

    for (int i = 0; i < len; i++)
      buffer[i + offset] = (byte) name.charAt(i);

    return len;
  }

  public Socket getSocket()
  {
    throw new UnsupportedOperationException(getClass().getName());
  }

  public void setSocket(Socket socket)
  {
    throw new UnsupportedOperationException(getClass().getName());
  }
  
  /**
   * Returns the TLS negotiated protocol, if available.
   */
  public String getNegotiatedProtocol()
  {
    return null;
  }

  /**
   * 
   */
  public byte[] getRemoteIP()
  {
    InetAddress addr = addressRemote();
    return addr.getAddress();
  }
  
  /**
   * Returns the remote client's port.
   */
  abstract public int portRemote();

  public void tcpNoDelay(boolean value)
    throws SocketException
  {
  }

  public void setSoTimeout(long ms)
    throws SocketException
  {
  }

  public long getSoTimeout()
  {
    return -1;
  }

  public void ssl(SSLFactory sslFactory)
  {
    throw new UnsupportedOperationException(getClass().getName());
  }

  /**
   * Returns true if the connection is secure.
   */
  public boolean isSecure()
  {
    return false;
  }

  /**
   * Returns any selectable channel.
   */
  public SelectableChannel selectableChannel()
  {
    throw new UnsupportedOperationException(getClass().getName());
  }

  /**
   * Returns the secure cipher algorithm.
   */
  public String cipherSuite()
  {
    return null;
  }

  /**
   * Returns the secure cipher algorithm.
   */
  public String secureProtocol()
  {
    return null;
  }

  /**
   * Returns the bits in the socket.
   */
  public int cipherBits()
  {
    return 0;
  }

  /**
   * Returns the client certificate.
   */
  public X509Certificate getClientCertificate()
    throws java.security.cert.CertificateException
  {
    return null;
  }

  /**
   * Returns the client certificate chain.
   */
  public X509Certificate []getClientCertificates()
    throws java.security.cert.CertificateException
  {
    X509Certificate cert = getClientCertificate();

    if (cert != null)
      return new X509Certificate[] { cert };
    else
      return null;
  }
  
  public void setRequestExpireTime(long expireTime)
  {
  }
920598
protected function recv() {
		if (($line = fgets($this->handle)) && 
			($line = trim($line))) {
			if ($this->logger) {
				$this->logger
					->onReceive($line);
			}
			
			return $line;
		}
		
		throw new \RuntimeException(
			"failed to receive data from {$this->server}");
	}
366969
public function nextLine()
	{
		$value = $this->getConnection()->_get_channel_packet(NET_SSH2_CHANNEL_EXEC);

		return $value === true ? null : $value;
	}
1010209
public boolean hasReplyCode() {
        return getHeader(FtpMessageHeaders.FTP_REPLY_CODE) != null ||
                Optional.ofNullable(commandResult)
                        .map(result -> StringUtils.hasText(result.getReplyCode()))
                        .orElse(false);
    }
263384
def recvfrom(self, buffersize, flags=0):
        '''
        
        '''
        _,remoteaddr,data = self._recv(buffersize)
        return data,remoteaddr
144045
@Override
    public byte[] deliverSmResp(int commandStatus, int sequenceNumber, String messageId) {
        PDUByteBuffer buf = new PDUByteBuffer(SMPPConstant.CID_DELIVER_SM_RESP,
                commandStatus, sequenceNumber);
        buf.append(messageId);
        return buf.toBytes();
    }
1148200
private function execCmd($cmd, &$stdout = null, &$stderr = null)
    {
        $descriptorspec = array(
            0 => array("pipe", "r"),  // stdin is a pipe that the child will read from
            1 => array("pipe", "w"),  // stdout is a pipe that the child will write to
            2 => array("pipe", "w")   // stderr is a file to write to
        );

        $pipes= array();
        $process = proc_open($cmd, $descriptorspec, $pipes);

        $stdout = "";
        $stderr = "";

        if (!is_resource($process)) {
            return false;
        }

        #close child's input imidiately
        fclose($pipes[0]);

        stream_set_blocking($pipes[1], false);
        stream_set_blocking($pipes[2], false);

        $todo= array($pipes[1],$pipes[2]);

        while (true) {
            $readstdout = [];
            $readstderr = [];

            if (false !== !feof($pipes[1])) {
                $readstdout[]= $pipes[1];
            }

            if (false !== !feof($pipes[2])) {
                $readstderr[]= $pipes[2];
            }

            if (empty($readstdout)) {
                break;
            }

            $write = null;
            $ex = null;
            $ready = stream_select($readstdout, $write, $ex, 2);

            if (false === $ready) {
                // probably dead process
                break;
            }

            foreach ($readstdout as $out) {
                $line = fread($out, 1024);
                $stdout.= $line;
            }

            foreach ($readstderr as $out) {
                $line = fread($out, 1024);
                $stderr.= $line;
            }
        }

        $stdout = strlen($stdout) > 0 ? $stdout : null;
        $stderr = strlen($stderr) > 0 ? $stderr : null;

        fclose($pipes[1]);
        fclose($pipes[2]);

        return proc_close($process);
    }
495029
public boolean send(VehicleMessage message) {
        VehicleMessage wrappedMessage = message;
        if(message instanceof DiagnosticRequest) {
            // Wrap the request in a Command
            wrappedMessage = new Command(message.asDiagnosticRequest(),
                    DiagnosticRequest.ADD_ACTION_KEY);
        }

        boolean sent = false;
        // Don't want to keep this in the same list as local interfaces because
        // if that quits after the first interface reports success.
        if(mRemoteService != null) {
            try {
                sent = mRemoteService.send(wrappedMessage);
            } catch(RemoteException e) {
                Log.v(TAG, "Unable to propagate command to remote interface", e);
            }
        }

        if(sent) {
            // Add a timestamp of when the message was actually sent
            message.timestamp();
        }

        return sent;
    }
763817
public void doProcess(InputStream in, PrintWriter out, Map<String, Object> properties)
        throws RemoteException
    {
        String strCommand = this.getProperty(REMOTE_COMMAND, properties);
        if (RECEIVE_REMOTE_MESSAGE.equals(strCommand))
        {
            Message message = ((RemoteReceiveQueue)m_remoteObject).receiveRemoteMessage();
            if (message != null)	// If the client quits, this is freed and I get a null message (which I don't need to return)
            	this.setReturnObject(out, message);
        }
        else if (ADD_REMOTE_MESSAGE_FILTER.equals(strCommand))
        {
            BaseMessageFilter messageFilter = (BaseMessageFilter)this.getNextObjectParam(in, FILTER, properties);
            String strSessionPathID = this.getNextStringParam(in, SESSION, properties);
            BaseHolder sessionHolder = this.getSessionFromPath(strSessionPathID);
            BaseMessageFilter objReturn = null;
            if (sessionHolder instanceof SessionHolder)
            {       // Always
                RemoteSession remoteSession = (RemoteSession)sessionHolder.getRemoteObject();
                objReturn = ((RemoteReceiveQueue)m_remoteObject).addRemoteMessageFilter(messageFilter, remoteSession);
            }
            else if (sessionHolder == null)
            {   // Session may be null.
                objReturn = ((RemoteReceiveQueue)m_remoteObject).addRemoteMessageFilter(messageFilter, null);
            }
            else
                Utility.getLogger().warning("Remote session not found");
            this.setReturnObject(out, objReturn);
        }
        else if (REMOVE_REMOTE_MESSAGE_FILTER.equals(strCommand))
        {
            BaseMessageFilter messageFilter = (BaseMessageFilter)this.getNextObjectParam(in, FILTER, properties);
            boolean bFreeFilter = this.getNextBooleanParam(in, FREE, properties);
            boolean bSuccess = ((RemoteReceiveQueue)m_remoteObject).removeRemoteMessageFilter(messageFilter, bFreeFilter);
            this.setReturnObject(out, new Boolean(bSuccess));
        }
        else if (UPDATE_REMOTE_FILTER_PROPERTIES.equals(strCommand))
        {
            BaseMessageFilter messageFilter = (BaseMessageFilter)this.getNextObjectParam(in, FILTER, properties);
            Object[][] propIn = (Object[][])this.getNextObjectParam(in, PROPERTIES, properties);
            Map<String,Object> propFilter = this.getNextPropertiesParam(in, MAP, properties);
            ((RemoteReceiveQueue)m_remoteObject).updateRemoteFilterProperties(messageFilter, propIn, propFilter);
        }
        else
            super.doProcess(in, out, properties);
    }
1041295
private void handleTelnetRpc(final Channel chan, final String[] command) {
    TelnetRpc rpc = rpc_manager.lookupTelnetRpc(command[0]);
    if (rpc == null) {
      rpc = unknown_cmd;
    }
    telnet_rpcs_received.incrementAndGet();
    rpc.execute(tsdb, chan, command);
  }
1205563
def reply(self, permlink, msgbody):
        ''' 
        '''
        for num_of_retries in range(default.max_retry): 
            try:
                self.steem_instance().post("message", 
                                            msgbody, 
                                            self.mainaccount, 
                                            None, 
                                            permlink, 
                                            None, None, "", 
                                            None, None, False)
            except Exception as e:
                self.util.retry("COULD NOT REPLY TO " + permlink, 
                    e, num_of_retries, default.wait_time)
                self.s = None
            else:
                self.msg.message("Replied to " + permlink)
                time.sleep(20)
                return True
151152
public Object doRemoteAction(String strCommand, Map<String, Object> properties) throws DBException, RemoteException
    {
        return null;    // Not supported
    }
584552
public Object doRemoteAction(String strCommand, Map<String, Object> properties) throws DBException, RemoteException
    {
        synchronized(m_objSync)
        {
            return m_tableRemote.doRemoteAction(strCommand, properties);
        }
    }
608520
public Object doRemoteAction(String strCommand, Map<String, Object> properties) throws DBException, RemoteException
    {
        BaseTransport transport = this.createProxyTransport(DO_REMOTE_ACTION);
        transport.addParam(NAME, strCommand);   // Don't use COMMAND
        transport.addParam(PROPERTIES, properties);
        Object strReturn = transport.sendMessageAndGetReply();
        if (strReturn instanceof String)
        {   // Could be returning a session
            BaseSessionProxy session = this.checkForSession((String)strReturn);
            if (session != null)
                return session;
        }
        Object objReturn = transport.convertReturnObject(strReturn);
        return this.checkDBException(objReturn);
    }