This repository contains three different implementations of chat applications in C, ranging from simple to more complex. Each application demonstrates different networking concepts and chat functionalities.
- π Repository Structure
- π¬ Applications
- π οΈ Building and Running
- π Dependencies
- π€ Contributing
- π License
ChatApp/
βββ Peer-to-Peer Chat APP/
β βββ chat_server.c
β βββ chat_client.c
βββ Group Chat APP/
β βββ group_chat_server.c
β βββ group_chat_client.c
βββ Peer-to-Peer WhatsAPP/
β βββ chat_shared.h
β βββ chat_server.c
β βββ chat_client.c
βββ README.md
A basic client-server chat application using UDP sockets. This application demonstrates one-to-one communication between a server and a client.
Features:
- π Turn-based communication
- π Simple connection handling
- βοΈ Basic message exchange
An extension of the simple UDP chat, allowing multiple clients to communicate in a group setting through a central server.
Features:
- π₯ Multiple client support
- π Message broadcasting
- π Client ID assignment
- πͺ Join and leave notifications
A more advanced chat application mimicking some features of messaging apps like WhatsApp. It uses a central server for user management and message routing but allows direct communication between users.
Features:
- π User registration and login
- π€ Online user list
- π Direct messaging between users
- π Basic error handling
- GCC compiler
- POSIX-compliant operating system (Linux, macOS, or Windows with WSL)
pthread
library
Navigate to the directory of the chat application you want to build and use the following commands:
For Simple UDP Chat and Group UDP Chat:
gcc group_chat_server.c -o server
gcc group_chat_client.c -o client
For P2P-style Chat:
gcc chat_server.c -o server -pthread
gcc chat_client.c -o client -pthread
-
Start the server:
./server
-
In separate terminal windows, start one or more clients:
./client
-
Follow the on-screen prompts to use the chat application.
- Standard C libraries
- POSIX sockets
- pthread library (for P2P-style chat)
Contributions to improve the chat applications or add new features are welcome! Please follow these steps:
- Fork the repository
- Create a new branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Happy chatting! π»π¬π