simple-socket library 1.9.0
Loading...
Searching...
No Matches
simple-socket library

An easy to use C++ socket and network library, for Unix based systems.

Overview

The following features are currently available:

  • IPv4 / IPv6 TCP and UDP sockets
  • Unix-domain stream, seqpacket and datagram sockets
  • UDP multicast support (IPv4 only)
  • Blocking and Non-Blocking I/O using the same API
  • Timeout support for connect, accept and receive (poll)
  • Peer-disconnect detection for connected sockets
  • Native descriptor adoption and duplication (e.g. socket activation)
  • Hostname and service resolution
  • Network-address and network-interface utilities
  • Optional SocketCAN and SCTP support
  • CMake build, unit tests and example programs

Design choices

  • RAII socket ownership with minimal internal state
  • Consistent string based interface for all address types
  • Expected network failures return IOResult, ConnectResult instead of throwing
  • Unexpect syscall errors are checked and throw SocketException
  • Transient failures (e.g. EINTR, accept) are handeled for the user
  • Created and accepted sockets have CLOEXEC enabled

License

This library is released under the MIT License.