连接转字符串

@param local1  本地地址
@param remote1 远程地址
@return 地址信息字符串
17435
public static String channelToString(SocketAddress local1, SocketAddress remote1) {
        try {
            InetSocketAddress local = (InetSocketAddress) local1;
            InetSocketAddress remote = (InetSocketAddress) remote1;
            return toAddressString(local) + " -> " + toAddressString(remote);
        } catch (Exception e) {
            return local1 + "->" + remote1;
        }
    }
1361187
@Override
  public InetAddress addressLocal()
  {
    SocketChannel s = _channel;
    
    if (s != null) {
      try {
        InetSocketAddress addr = (InetSocketAddress) s.getLocalAddress();
        
        return addr.getAddress();
      } catch (IOException e) {
        throw new RuntimeException(e);
      }
    }
    else {
      return null;
    }
  }
215581
public function addKnownSchemaLocation(string $remote, string $local): void
    {
        $this->knownLocationSchemas[$remote] = $local;
    }
1127652
public File getLocalFile(URL remoteUri)
    {
        StringBuilder sb = new StringBuilder();

        String host = remoteUri.getHost();
        String query = remoteUri.getQuery();
        String path = remoteUri.getPath();

        if (host != null)
        {
            sb.append(host);
        }
        if (path != null)
        {
            sb.append(path);
        }
        if (query != null)
        {
            sb.append('?');
            sb.append(query);
        }

        String name;

        final int maxLen = 250;

        if (sb.length() < maxLen)
        {
            name = sb.toString();
        }
        else
        {
            name = sb.substring(0, maxLen);
        }

        name = name.replace('?', '$');
        name = name.replace('*', '$');
        name = name.replace(':', '$');
        name = name.replace('<', '$');
        name = name.replace('>', '$');
        name = name.replace('"', '$');

        File f = new File(cacheDir, name);

        return f;
    }
132688
public function get($local_file, $remote_file, $overwrite = false)
    {
        if (false === $overwrite && true === file_exists($local_file)) {
            return $this->_trigger_error(sprintf('Local file already exists: %s.', $local_file));
        }

        $remote_file = $this->_getAbsoluteRemotePath($remote_file);
        if (false === file_exists($remote_file)) {
            return $this->_trigger_error(sprintf('Could not open remote file: %s.', $remote_file));
        }

        if (false === @copy($remote_file, $local_file)) {
            return $this->_trigger_error(sprintf('Could not send data from file %s to file %s.', $remote_file, $local_file));
        }

        return true;
    }
1014049
public LocalRepositoryManager localRepositoryManager(final RepositorySystemSession session, boolean legacyLocalRepository) {
        Validate.notNull(session, "session must be specified");
        String localRepositoryPath = settings.getLocalRepository();
        Validate.notNullOrEmpty(localRepositoryPath, "Path to a local repository must be defined");

        SWRLocalRepositoryManager factory = SWRLocalRepositoryManager.ENHANCED;
        // here we rely either on system property or flag passed by caller
        if (useLegacyLocalRepository || legacyLocalRepository) {
            factory = SWRLocalRepositoryManager.LEGACY;
        }
        if (settings.isOffline()) {
            factory = SWRLocalRepositoryManager.SIMPLE;
        }

        LocalRepositoryManager manager = factory.localRepositoryManager(system, session, new File(localRepositoryPath));
        return manager;
    }
691950
protected boolean doConnect(SocketAddress remoteAddress, SocketAddress localAddress) throws Exception {
        if (localAddress instanceof InetSocketAddress) {
            checkResolvable((InetSocketAddress) localAddress);
        }

        InetSocketAddress remoteSocketAddr = remoteAddress instanceof InetSocketAddress
                ? (InetSocketAddress) remoteAddress : null;
        if (remoteSocketAddr != null) {
            checkResolvable(remoteSocketAddr);
        }

        if (remote != null) {
            // Check if already connected before trying to connect. This is needed as connect(...) will not return -1
            // and set errno to EISCONN if a previous connect(...) attempt was setting errno to EINPROGRESS and finished
            // later.
            throw new AlreadyConnectedException();
        }

        if (localAddress != null) {
            socket.bind(localAddress);
        }

        boolean connected = doConnect0(remoteAddress);
        if (connected) {
            remote = remoteSocketAddr == null?
                    remoteAddress : computeRemoteAddr(remoteSocketAddr, socket.remoteAddress());
        }
        // We always need to set the localAddress even if not connected yet as the bind already took place.
        //
        // See https://github.com/netty/netty/issues/3463
        local = socket.localAddress();
        return connected;
    }
682351
public static WsonrpcRemote getRemote(String sessionId) {
        if (sessionId == null) {
            return null;
        }
        return remotes.get(sessionId);
    }
957311
@Override
  public InetAddress addressRemote()
  {
    if (_remoteAddr == null) {
      try {
        _remoteAddr = InetAddress.getByName(getRemoteHost());
      } catch (Exception e) {
        log.log(Level.FINE, e.toString(), e);
      }
    }

    return _remoteAddr;
  }
29392
public InetAddress getRemoteAddress() throws IOException {
        return InetAddress.getByName(
            new RqHeaders.Smart(new RqHeaders.Base(this))
                .single("X-Takes-RemoteAddress")
        );
    }
1240806
@Override
    public String getValue(String uri, String local) {
        int index = getIndex(uri, local);

        if (index < 0) {
            return null;
        }
        return getValue(index);
    }
993918
public static int openAndBindPortToLocal(Connector sshConn, String remoteHost, int remotePort) throws JschRuntimeException {
		final Session session = openSession(sshConn.getHost(), sshConn.getPort(), sshConn.getUser(), sshConn.getPassword());
		if (session == null) {
			throw new JschRuntimeException("Error to create SSH Session！");
		}
		final int localPort = generateLocalPort();
		bindPort(session, remoteHost, remotePort, localPort);
		return localPort;
	}
195115
public RemoteTable getRemoteTableType(Class<?> classType) throws RemoteException
    {
        if (org.jbundle.model.Remote.class.getName().equals(classType.getName()))
            return this;    // For this purpose I am the remote object.
        return null;    // This method is never called remotely
    }
1309888
def do_local(self, host="localhost", port=8000):
        
        port = int(port)
        if host == "off":
            self._local_endpoint = None
        else:
            self._local_endpoint = (host, port)
        self.onecmd("use %s" % self.engine.region)
103578
def remote_url(self):
        
        cmd = 'svn info | grep "^Repository Root:"'
        return (
            self.sh(cmd, shell=True).split(': ', 1)[1]).strip()
1062159
public function get($local, $remote, $mode = FTP_BINARY)
    {
        return ($this->isConnected() === true) ? ftp_get($this->getConnection(), $local, $remote, $mode) : false;
    }
1029248
public boolean verifySender(InetAddress remoteAddr) {
        boolean returnValue = true;

        if (alists != null) {
            returnValue = !alists.accessDenied(remoteAddr);
        }
        return returnValue;
    }