eckit::net::TCPServer class

Base classes

class TCPSocket

Derived classes

class eckit::ProxiedTCPServer
class EphemeralTCPServer

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

TCPServer(const SocketOptions& = SocketOptions::server())
TCPServer(int port, const SocketOptions& = SocketOptions::server()) explicit
~TCPServer()

Public functions

void willFork(bool)
auto accept(const std::string& message = "Waiting for connection", int timeout = 0, bool* connected = nullptr) -> TCPSocket& virtual
void closeExec(bool on)
auto socket() -> int override
void close() override
auto write(const void* buf, long length) const -> long
auto read(void* buf, long length) const -> long
auto rawRead(void*, long) -> long
auto isConnected() const -> bool
auto stillConnected() const -> bool
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)
void closeOutput()
void closeInput()
void debug(bool on)

Public variables

bool on
bool newline
char mode

Private functions

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

Function documentation

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

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

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

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

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

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

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::TCPServer::rawRead(void*, long)

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

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

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

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

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

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

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

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

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

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

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

void eckit::net::TCPServer::closeOutput()

void eckit::net::TCPServer::closeInput()

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

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

Variable documentation

bool eckit::net::TCPServer::on

bool eckit::net::TCPServer::newline

char eckit::net::TCPServer::mode