# libsockbus C++17 TCP socket IPC library. Broker-based broadcast bus with length-prefixed framing. Bytes in, bytes out. **Author:** Are Bjørby No routing, parsing, or protocol logic. ## Build ```bash make # Build libsockbus.a + libsockbus.so make test # Build and run all 48 tests make install # Install to /usr/local (sudo required) make clean # Remove build artifacts ``` Requires: `g++` with C++17 support. Linux only (POSIX sockets). ## API Single public header: `#include ` ```cpp sockbus::create("127.0.0.1:9000"); // Start broker sockbus::Bus bus("127.0.0.1:9000"); // Connect (RAII) bus.write(data, len); // Broadcast (framed) bus.write(string_view); // Broadcast (string_view) bus.read(buf, len); // Non-blocking read bus.read_wait(buf, len, timeout_ms); // Blocking read // ~Bus() disconnects (RAII) sockbus::destroy("127.0.0.1:9000"); // Stop broker ``` ## Design - **Broker model**: Each bus runs a listener thread. Clients connect via TCP. - **Broadcast**: All connected readers (including sender) receive every write. - **Lossy**: Slow readers are dropped, never buffered. - **Wire frame**: 4-byte length prefix (network byte order) + payload. - **Name resolution**: Literal `host:port` or symbolic via config file. - **Crash-safe**: Dead clients detected and cleaned up by broker. See `docs/SOCKBUS_SPEC.md` for the full specification. ## Contributing See [CONTRIBUTING.md](CONTRIBUTING.md) for coding standards and how to contribute. ## License MIT License — see [LICENSE](LICENSE).