This project provides a modular C++ networking solution with reusable components for building and testing socket servers.
- π§© Modular Design: Organized into server and socket components for clarity and scalability.
- π Socket Abstraction: Easy-to-use classes for creating binding and listening sockets.
- π Test Server: A simple server implementation for quick development and testing.
- π οΈ Custom Networking Tools: Extendable components to suit your networking needs.
.
βββ BUILD.bazel
βββ MODULE.bazel
βββ MODULE.bazel.lock
βββ README.md
βββ main_server.cpp
βββ main_socket.cpp
βββ networking
βββ BUILD.bazel
βββ lib
β βββ BUILD.bazel
β βββ binding_socket
β β βββ BUILD.bazel
β β βββ binding_socket.cpp
β β βββ binding_socket.hpp
β βββ lib.hpp
β βββ listening_socket
β β βββ BUILD.bazel
β β βββ listening_socket.cpp
β β βββ listening_socket.hpp
β βββ socket
β βββ BUILD.bazel
β βββ socket.cpp
β βββ socket.hpp
βββ server
βββ BUILD.bazel
βββ server.cpp
βββ server.hpp
βββ test_server.cpp
βββ test_server.hpp
Using Bazel for compiling and runnig the applications
- Buidling the
main_socketlibbash bazel build //:main_socket - Running the
main_socketlibbash bazel run //:main_socket - Buidling the
main_serverlibbash bazel build //:main_server - Running the
main_serverlibbash bazel run //:main_socket
If you are willing to build the supporting the libraries
- Buidling the socket lib
bash bazel build //networking/lib/socket:socket - Buidling the server lib
bash bazel build //networking/server/server:server
Server Initialization: The Server base class initializes sockets and manages communication.
Test Server: The TestServer class extends the Server class and handles:
- acceptor(): Accepts incoming connections.
- handler(): Reads client messages.
- responder(): Sends responses back to the client.
Socket Abstraction:
- Provides reusable components for binding, listening, and handling sockets.
The browser making the request and getting the response
The server logs
To compile the test server
g++ -std=c++11 -I./networking main_server.cpp networking/*/*.cpp -o server
To compile the socket listener
g++ -std=c++11 -I./networking main_socket.cpp networking/*/*.cpp -o socket
Thanks to Eric's Videos which made this possible!

