|
TEC
A lightweight C++ library enabling safe, efficient execution in multithreaded and concurrent systems.
|
Common parameters used for both client and server socket configuration. More...
#include <tec_socket.hpp>
Public Member Functions | |
| SocketParams () | |
| Default constructor. | |
Public Attributes | |
| std::string | addr |
| Target address or hostname. | |
| int | port |
| Port number to connect to or bind. | |
| int | family |
| Address family (AF_INET, AF_INET6, AF_UNSPEC, ...). | |
| int | socktype |
| Socket type (SOCK_STREAM, SOCK_DGRAM, ...). | |
| int | protocol |
| Protocol (usually 0). | |
| int | flags |
| Flags passed to getaddrinfo(). | |
| int | compression |
| Compression algorithm to use (see CompressionParams). | |
| int | compression_level |
| Compression level [0..9] (higher = better compression, slower). | |
| size_t | compression_min_size |
| Minimum size of data to apply compression (bytes). | |
| size_t | buffer_size |
| Buffer size for using in send/recv operations (bytes). | |
Static Public Attributes | |
| static constexpr char | kAnyAddr [] {"0.0.0.0"} |
| IPv4 address to bind/accept connections from any interface. | |
| static constexpr char | kLocalAddr [] {"127.0.0.1"} |
| IPv4 loopback address (localhost). | |
| static constexpr char | kLocalURI [] {"localhost"} |
| Hostname that resolves to localhost for both IPv4 and IPv6. | |
| static constexpr char | kAnyAddrIP6 [] {"::"} |
| IPv6 address to bind/accept connections from any interface. | |
| static constexpr char | kLocalAddrIP6 [] {"::1"} |
| IPv6 loopback address (localhost). | |
| static constexpr int | kDefaultPort {4321} |
| Default port number used for testing and examples. | |
| static constexpr int | kDefaultFamily {AF_UNSPEC} |
| Default address family: AF_UNSPEC allows both IPv4 and IPv6. | |
| static constexpr int | kDefaultSockType {SOCK_STREAM} |
| Default socket type: TCP stream socket. | |
| static constexpr int | kDefaultProtocol {0} |
| Default protocol: 0 means "any appropriate protocol". | |
| static constexpr int | kDefaultServerFlags {AI_PASSIVE} |
| Default addrinfo flags for server sockets (bind to local address). | |
| static constexpr int | kDefaultClientFlags {0} |
| Default addrinfo flags for client sockets (no special behaviour). | |
| static constexpr char | kNullChar {0} |
| Null character constant (for internal use). | |
| static constexpr size_t | kDefaultBufSize {BUFSIZ} |
| Default buffer size as defined in stdio.h (8192). | |
Common parameters used for both client and server socket configuration.
This structure holds all configurable options for creating and binding sockets, including address, port, address family, socket type, protocol, and compression settings.
|
inline |
Default constructor.
Initializes with sensible defaults suitable for a client connecting to localhost.