libuv::tcp namespace

Contents

Namespace which allows using libuv TCP.

Classes

template<typename Base = detail::connection_base>
class connection
template<typename Port, typename Connection = typename Port::template connection<connection>>
class port

Functions

template<typename Connection, typename Functor, typename... TN>
void connect(const struct sockaddr* addr, const Functor& cb, TN && ... args)
template<typename Connection, typename Functor, typename... TN>
void connect(const char* ip, int port, const Functor& cb, TN && ... args)

Function documentation

template<typename Connection, typename Functor, typename... TN>
void libuv::tcp::connect(const struct sockaddr* addr, const Functor& cb, TN && ... args)

Asynchronously connects to the given address. The expected signature of the callback is

void(const char *error, std::shared_ptr<Connection>, TN&&...)

If the connection fails, the callback is called with the error as first argument and an empty shared_ptr. If the connection was successfully established, error is nullptr.

template<typename Connection, typename Functor, typename... TN>
void libuv::tcp::connect(const char* ip, int port, const Functor& cb, TN && ... args)

Asynchronously connects to the given ip and port. The expected signature of the callback is

void(const char *error, std::shared_ptr<Connection>, TN&&...)

If the connection fails, the callback is called with the error as first argument and an empty shared_ptr. If the connection was successfully established, error is nullptr.