Welcome to the Network Server Collection! 🎉
This repository contains multiple variations of a TCP client-server application implemented in C and C++. Each project explores a different approach to handling multiple clients and concurrency or specific purpuses (fot ex. calclator), all while adhering to clean and reusable object-oriented design principles.
-
Simple-Client-Server A simpler, single-client implementation showcasing the basics network socket programming in c.
-
Client-Server-Calculator A simpler, single-client implementation showcasing the basics network socket programming in c, which is a calculator with basic operations.
-
Client-Server-cpp-fork
A process-based version where the server spawns a new process (fork
) for each client. While this approach supports multiple clients, shared resources (like the server terminal) are not protected in this version. -
Client-Server-cpp-threads
A multithreaded version of the server where each client connection is handled by a separate thread. Synchronization is ensured usingstd::mutex
, making it safe for shared resources like the server terminal.
- Object-Oriented Design: Classes like
Net::Socket
andNet::InetSocketAddress
encapsulate low-level networking functionality. - TCP Communication: Send and receive messages between a client and server.
- Graceful Shutdown: Use the keywords to close a session cleanly.
- Port Reuse: Avoid port conflicts with
SO_REUSEADDR
.
Each project has its own directory with a detailed README and makefile
. Pick a version, compile it, and enjoy! 🚀
v1.0
– Initial version with single-client support.v2.0
– Multithreaded version (Client-Server-cpp-threads
).v2.1
– Fork-based version (Client-Server-cpp-fork
).latest
– Always points to the most recent stable update.
Enjoy experimenting with these projects, and feel free to contribute or suggest new ideas!