eckit::net::TCPSocket class

Derived classes

class TCPClient
class TCPServer

Public types

class UnknownHost

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

TCPSocket()
TCPSocket(net::TCPSocket&)
~TCPSocket() virtual

Public functions

auto operator=(net::TCPSocket&) -> TCPSocket&
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
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)

Public variables

bool on
bool newline
char mode

Private functions

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

Friends

auto operator<<(std::ostream& s, const TCPSocket& socket) -> std::ostream&

Function documentation

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

eckit::net::TCPSocket::TCPSocket(net::TCPSocket&)

long eckit::net::TCPSocket::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)

void eckit::net::TCPSocket::bind() virtual private

This website is beyond its original expiry date and the content may be out of date. The site owner has been notified and may choose to extend the expiry date and remove this banner. If you have any questions about this, please visit our support portal.