template<typename Port, typename Connection = typename Port::template connection<connection>>
libuv::tcp::port class

Contents

This class implements a TCP port. It will accept connections and create instances of Connection.

Public functions

auto listen(int port, const char* ip) -> int
auto get_port_number(uint16_t& n) -> bool

Function documentation

template<typenamePort, typenameConnection>
int libuv::tcp::port<Port, Connection>::listen(int port, const char* ip)

Listen to the given port and ip. Returns the error code returned by uv_tcp_bind() and uv_listen().

template<typenamePort, typenameConnection>
bool libuv::tcp::port<Port, Connection>::get_port_number(uint16_t& n)

Returns the port number this port is bound to. Returns false on failure.