DRPCClientを生成する。

@param host DRPCServerホスト
@param port DRPCServerポート
@param timeout DRPCタイムアウト(ミリ秒単位)
@return DRPCClient
173982
protected DRPCClient createClient(String host, int port, int timeout)
    {
        return new DRPCClient(host, port, timeout);
    }
1148077
def tcp_socket_request
      Timeout.timeout(request_timeout) do
        s = TCPSocket.new(host, port)
        s.close
      end
    rescue Errno::ECONNREFUSED => e
      addl_message = "#{host} is not accepting connections on port #{port}: "
      raise ConnectionFailed, addl_message + e.message
    rescue SocketError => e
      addl_message = "connection to #{host} on port #{port} failed with '#{e.message}': "
      raise ConnectionFailed, addl_message + e.message
    rescue Timeout::Error => e
      addl_message = "#{host} did not respond on port #{port} within #{request_timeout} seconds: "
      raise ConnectionFailed, addl_message + e.message
    rescue => e
      raise ConnectionFailed, e
    end
145009
public static Function<RSocket, RSocket> timeout(Duration timeout) {
    return source ->
        new RSocketProxy(source) {
          @Override
          public Mono<Void> fireAndForget(Payload payload) {
            return source.fireAndForget(payload).timeout(timeout);
          }

          @Override
          public Mono<Payload> requestResponse(Payload payload) {
            return source.requestResponse(payload).timeout(timeout);
          }

          @Override
          public Flux<Payload> requestStream(Payload payload) {
            return source.requestStream(payload).timeout(timeout);
          }

          @Override
          public Flux<Payload> requestChannel(Publisher<Payload> payloads) {
            return source.requestChannel(payloads).timeout(timeout);
          }

          @Override
          public Mono<Void> metadataPush(Payload payload) {
            return source.metadataPush(payload).timeout(timeout);
          }
        };
  }
968095
public static NetworkPort remoteDatagramPort(String hostname, int port){
        return new RemoteNetworkPort(hostname, port, NetworkPort.Type.UDP);
    }
982060
public final Connection connectNow(Duration timeout) {
		Objects.requireNonNull(timeout, "timeout");
		try {
			return Objects.requireNonNull(connect().block(timeout), "aborted");
		}
		catch (IllegalStateException e) {
			if (e.getMessage().contains("blocking read")) {
				throw new IllegalStateException("TcpClient couldn't be started within "
						+ timeout.toMillis() + "ms");
			}
			throw e;
		}
	}
1091649
private CoronaTaskTrackerProtocol createClient(String host, int port)
    throws IOException {
    String staticHost = NetUtils.getStaticResolution(host);
    InetSocketAddress s = null;
    InetAddress  inetAddress = null;
    byte[] byteArr = null;
    if (staticHost != null) {
      inetAddress = InetAddress.getByName(staticHost);
    } else {
      byteArr = Utilities.asBytes(host);
      if ( byteArr == null) {
        inetAddress = InetAddress.getByName(host);
      }
      else {
        inetAddress = InetAddress.getByAddress(byteArr);
      }
    }
    s = new InetSocketAddress(inetAddress, port);
    LOG.info("Creating client to " + 
      (staticHost != null ? staticHost : host) + ":" + s.getPort());
    long connectTimeout =
      conf.getLong(CoronaJobTracker.TT_CONNECT_TIMEOUT_MSEC_KEY, 10000L);
    int rpcTimeout =
      conf.getInt(CoronaJobTracker.TT_RPC_TIMEOUT_MSEC_KEY, 60000);
    return RPC.waitForProxy(
      CoronaTaskTrackerProtocol.class,
      CoronaTaskTrackerProtocol.versionID,
      s,
      conf,
      connectTimeout,
      rpcTimeout);
  }
1340166
public static Cluster connectCluster(String host, int port) {
	Builder clusterBuilder = Cluster.builder();
	// Socket Options
	SocketOptions socketOptions = new SocketOptions();
	socketOptions.setConnectTimeoutMillis(60000);
	socketOptions.setKeepAlive(true);
	socketOptions.setReadTimeoutMillis(30000);
	return clusterBuilder.addContactPoint(host)
		.withSocketOptions(socketOptions).withPort(port).build();
    }
102232
@Override
	public HttpConnection getConnectionWithTimeout(
			HostConfiguration hostConfiguration, long timeout) {

		if (httpConnection == null) {
			httpConnection = new ZapHttpConnection(hostConfiguration);
			httpConnection.setHttpConnectionManager(this);
			httpConnection.getParams().setDefaults(this.getParams());
		}
		
		return super.getConnectionWithTimeout(hostConfiguration, timeout);
	}
1168880
public static HostAndPort of(String host, int port) {

        LettuceAssert.isTrue(isValidPort(port), String.format("Port out of range: %s", port));

        HostAndPort parsedHost = parse(host);
        LettuceAssert.isTrue(!parsedHost.hasPort(), String.format("Host has a port: %s", host));
        return new HostAndPort(host, port);
    }
1303011
function serverReady (port, ...args) {
  const start = new Date()
  let timeout = serverReady.timeout
  let host, hostOrTimeout, cb

  switch (args.length) {
    case 1:
      [cb] = args
      break
    case 2:
      [hostOrTimeout, cb] = args
      if (typeof hostOrTimeout === 'string') {
        host = hostOrTimeout
      } else {
        timeout = hostOrTimeout
      }
      break
    default:
      [host, timeout, cb] = args
  }

  cb = once(cb)

  let ready = false
  const connect = (port, cb) => {

    const client = net
      .connect({ port, host })
      .on('connect', () => {

        ready = true
        client.destroy()
        cb()

      })
      .on('error', () => {

        client.destroy()

      })
      .once('close', () => {

        if (new Date() - start > timeout) {
          return cb(new Error('Timeout'))
        }

        setTimeout(() => !ready && connect(port, cb), interval)

      })

  }

  connect(port, cb)
}
1369956
function createClient(port, host, password) {
	var client = redis.createClient(port, host, {
		connect_timeout: false, // Never stop trying to connect to Redis...
		max_attempts: null, // ... no matter how many times it slaps us in the face.
		retry_max_delay: 5000, // Decay attempts to reconnect to a max of 5 seconds.
		enable_offline_queue: true // Queue up requests while we wait for a connection to re-establish.
	});

	client.on('error', function(err) {
		// Log the error, but don't quit. Our offline queue will keep us going until Redis comes back.
		log.error(err);
	});

	if (client && password) {
		client.auth(password);
	}

	return client;
}
1110787
def _do_timeout_for_query(self, timeout, datapath):
        """"""
        dpid = datapath.id

        hub.sleep(timeout)
        outport = self._to_querier[dpid]['port']

        remove_dsts = []
        for dst in self._to_hosts[dpid]:
            if not self._to_hosts[dpid][dst]['replied']:
                # if no REPORT message sent from any members of
                # the group, remove flow entries about the group and
                # send a LEAVE message if exists.
                self._remove_multicast_group(datapath, outport, dst)
                remove_dsts.append(dst)

        for dst in remove_dsts:
            del self._to_hosts[dpid][dst]
511992
def get_socket(host, port, timeout=None):
    
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
        af, socktype, proto, canonname, sa = res
        sock = None
        try:
            sock = socket(af, socktype, proto)
            if timeout is not None:
                sock.settimeout(timeout)
            sock.connect(sa)
            return sock

        except error:
            if sock is not None:
                sock.close()

    raise error
598537
private MBeanServerConnection createServerConnection(String host, int port) throws IOException {
            jmxServiceURL = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://" + host + ":" + port + "/jmxrmi");
            JMXConnector jmxc = JMXConnectorFactory.connect(jmxServiceURL, null);
            return jmxc.getMBeanServerConnection();            
    }
1265642
public function checkAtOnce(string $addr, int $port = 0, int $timeout = 3): Result {
        try {
            $res = $this->http()->get((0 === strpos($addr, 'http') ? $addr : 'http://' . $addr) . ($port ? ':' . $port : ''), [
                'timeout' => $timeout,
                'connect_timeout' => $timeout,
            ])->getBody()->getContents();
            $ok = true;
            $err = '';
            if (false === strpos($res, 'Jetbrains License Server')) {
                $ok = false;
                $err = 'response body not contain substr, body: ' . $res;
            }
        } catch (\Exception $e) {
            $ok = false;
            $err = $e->getMessage();
        }
        return new Result(static::class, $addr, $port, $ok, $err);
    }
440922
@Deprecated
    public RpcInternalContext setLocalAddress(String host, int port) {
        if (host == null) {
            return this;
        }
        if (port < 0 || port > 0xFFFF) {
            port = 0;
        }
        // 提前检查是否为空，防止createUnresolved抛出异常，损耗性能
        this.localAddress = InetSocketAddress.createUnresolved(host, port);
        return this;
    }
135681
def wait_socket(host, port, timeout=120):
    '''
    
    '''
    return wait_result(lambda: check_socket(host, port), True, timeout)