eckit::net::TCPClient class

Base classes

class TCPSocket

Derived classes

class eckit::ProxiedTCPClient

Public static functions

static auto addrToHost(in_addr) -> std::string
static auto hostToAddr(const std::string&) -> in_addr
static auto hostName(const std::string& h, bool full = false) -> std::string
static void register_ignore_sigpipe()

Constructors, destructors, conversion operators

TCPClient(const SocketOptions& options = SocketOptions::none())
TCPClient(int port, const SocketOptions& options = SocketOptions::none())
~TCPClient()

Public functions

auto connect(const std::string& host, int port, int retries = 5, int timeout = 0) -> TCPSocket& virtual
auto connect(const net::Endpoint& endpoint, int retries = 5, int timeout = 0) -> TCPSocket& virtual
auto write(const void* buf, long length) -> long
auto read(void* buf, long length) -> long
auto rawRead(void*, long) -> long
auto isConnected() const -> bool
auto stillConnected() const -> bool
void close() virtual
auto remoteAddr() const -> in_addr
auto remoteHost() const -> const std::string&
auto remotePort() const -> int
auto localAddr() const -> in_addr
auto localHost() const -> const std::string&
auto localPort() const -> int
void bufferSize(int n)
void receiveBufferSize(int n)
void sendBufferSize(int n)
auto socket() -> int virtual
void closeOutput()
void closeInput()
void debug(bool on)

Private functions

void print(std::ostream& s) const override
void bind() override
auto bindingAddress() const -> std::string override

Function documentation

static std::string eckit::net::TCPClient::addrToHost(in_addr)

static in_addr eckit::net::TCPClient::hostToAddr(const std::string&)

static std::string eckit::net::TCPClient::hostName(const std::string& h, bool full = false)

static void eckit::net::TCPClient::register_ignore_sigpipe()

long eckit::net::TCPClient::write(const void* buf, long length)

long eckit::net::TCPClient::read(void* buf, long length)

Parameters
buf The buffer to read into
length The maximum number of bytes to read

Read from a TCP socket

Configuration flags

  • useSelectOnTCPSocket (bool): use select for improved resilience on flaky connections
  • socketSelectTimeout (long): timeout in seconds for the select (only if useSelectOnTCPSocket is enabled)

long eckit::net::TCPClient::rawRead(void*, long)

bool eckit::net::TCPClient::isConnected() const

bool eckit::net::TCPClient::stillConnected() const

void eckit::net::TCPClient::close() virtual

in_addr eckit::net::TCPClient::remoteAddr() const

const std::string& eckit::net::TCPClient::remoteHost() const

int eckit::net::TCPClient::remotePort() const

in_addr eckit::net::TCPClient::localAddr() const

const std::string& eckit::net::TCPClient::localHost() const

int eckit::net::TCPClient::localPort() const

void eckit::net::TCPClient::bufferSize(int n)

void eckit::net::TCPClient::receiveBufferSize(int n)

void eckit::net::TCPClient::sendBufferSize(int n)

int eckit::net::TCPClient::socket() virtual

void eckit::net::TCPClient::closeOutput()

void eckit::net::TCPClient::closeInput()

void eckit::net::TCPClient::debug(bool on)

void eckit::net::TCPClient::bind() override private