VinayHajare / chat-apps-in-c

Simple chat app implemented in C using Socket programming with different architectures.

Repository from Github https://github.comVinayHajare/chat-apps-in-cRepository from Github https://github.comVinayHajare/chat-apps-in-c

πŸ—¨οΈ C Chat Applications Collection

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.

πŸ“š Table of Contents

  1. πŸ“ Repository Structure
  2. πŸ’¬ Applications
  3. πŸ› οΈ Building and Running
  4. πŸ“š Dependencies
  5. 🀝 Contributing
  6. πŸ“„ License

πŸ“ Repository Structure

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

πŸ’¬ Applications

Simple UDP Peer-to-Peer Chat

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

Group UDP Chat

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

Peer-to-Peer Whatsapp style Chat

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

πŸ› οΈ Building and Running

Prerequisites

  • GCC compiler
  • POSIX-compliant operating system (Linux, macOS, or Windows with WSL)
  • pthread library

Compilation

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

Running the Applications

  1. Start the server:

    ./server
  2. In separate terminal windows, start one or more clients:

    ./client
  3. Follow the on-screen prompts to use the chat application.

πŸ“š Dependencies

  • Standard C libraries
  • POSIX sockets
  • pthread library (for P2P-style chat)

🀝 Contributing

Contributions to improve the chat applications or add new features are welcome! Please follow these steps:

  1. Fork the repository
  2. Create a new branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


Happy chatting! πŸ’»πŸ’¬πŸŽ‰

About

Simple chat app implemented in C using Socket programming with different architectures.

License:MIT License


Languages

Language:C 100.0%