All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.vertx.core.net.NetClient Maven / Gradle / Ivy

There is a newer version: 4.5.10
Show newest version
/*
 * Copyright (c) 2011-2013 The original author or authors
 * ------------------------------------------------------
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * and Apache License v2.0 which accompanies this distribution.
 *
 *     The Eclipse Public License is available at
 *     http://www.eclipse.org/legal/epl-v10.html
 *
 *     The Apache License v2.0 is available at
 *     http://www.opensource.org/licenses/apache2.0.php
 *
 * You may elect to redistribute this code under either of these licenses.
 */

package io.vertx.core.net;

import io.vertx.core.AsyncResult;
import io.vertx.core.Handler;
import io.vertx.codegen.annotations.Fluent;
import io.vertx.codegen.annotations.VertxGen;
import io.vertx.core.metrics.Measured;

/**
 * A TCP client.
 * 

* Multiple connections to different servers can be made using the same instance. *

* This client supports a configurable number of connection attempts and a configurable * delay between attempts. * * @author Tim Fox */ @VertxGen public interface NetClient extends Measured { /** * Open a connection to a server at the specific {@code port} and {@code host}. *

* {@code host} can be a valid host name or IP address. The connect is done asynchronously and on success, a * {@link NetSocket} instance is supplied via the {@code connectHandler} instance * * @param port the port * @param host the host * @return a reference to this, so the API can be used fluently */ @Fluent NetClient connect(int port, String host, Handler> connectHandler); /** * Close the client. *

* Any sockets which have not been closed manually will be closed here. The close is asynchronous and may not * complete until some time after the method has returned. */ void close(); }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy