Welcome to TinyServer, a straightforward and lightweight messaging server that allows multiple clients to communicate with each other, just like in a group chat! 💬✨
- Multi-client Support: Handle multiple clients simultaneously using threads. 👥
- Instant Messaging: Forward messages to all connected clients instantly! ⚡
- Exit Commands: Cleanly disconnect clients with specific commands like
exit
,quit
,bye
, etc. 👋
- A C compiler (like
gcc
) - Basic knowledge of C programming and networking concepts 🌐
-
Clone the repository:
git clone https://github.com/yourusername/TinyServer.git cd TinyServer
-
Compile the server and client:
make
-
Start the Server: Run the server and specify a port number:
make run_server ARGS="<port_number>"
Example:
make run_server ARGS="9999"
-
Connect the Client: In another terminal, run the client:
make run_client ARGS="<hostname> <port_number>"
Example:
make run_client ARGS="loopback 9999"
-
Start Chatting: Send messages between clients! 🎉
The project consists of two main files:
/messaging/tcp_server.c
: The main server code that handles client connections and message forwarding./messaging/tcp_client.c
: The client code that sends and receives messages.
- The server listens for incoming connections on a specified port. 📡
- When a client connects, it creates a new thread to handle that client. 🔄
- Messages received from any client are instantly forwarded to all other connected clients. 🔊
Contributions are welcome! If you have suggestions or improvements, feel free to open an issue or submit a pull request. 💡
This project is licensed under the MIT License.