{"id":20899636,"url":"https://github.com/muszic/chat-application","last_synced_at":"2025-10-24T23:45:48.956Z","repository":{"id":249694855,"uuid":"832257214","full_name":"Muszic/chat-application","owner":"Muszic","description":"Dive into real-time communication with this C++ chat application! Featuring a server-client model, it lets multiple users chat seamlessly, showcasing the power of sockets and threads in a fun and interactive way.","archived":false,"fork":false,"pushed_at":"2024-07-22T17:05:11.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-19T12:54:22.639Z","etag":null,"topics":["cpp","multithreading","networking","socket-programming","tcp"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Muszic.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-22T16:31:47.000Z","updated_at":"2024-07-23T23:22:45.000Z","dependencies_parsed_at":"2024-07-22T20:39:40.191Z","dependency_job_id":null,"html_url":"https://github.com/Muszic/chat-application","commit_stats":null,"previous_names":["muszic/chat-application"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Muszic%2Fchat-application","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Muszic%2Fchat-application/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Muszic%2Fchat-application/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Muszic%2Fchat-application/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Muszic","download_url":"https://codeload.github.com/Muszic/chat-application/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243285626,"owners_count":20266849,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpp","multithreading","networking","socket-programming","tcp"],"created_at":"2024-11-18T11:15:00.166Z","updated_at":"2025-10-24T23:45:48.854Z","avatar_url":"https://github.com/Muszic.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Chat Application (Server-Client Model)\n## Introduction\nThis project is a simple chat application that demonstrates a server-client model using C++ with sockets and threads. The server can handle multiple clients, allowing them to connect and communicate with each other. The server manages client connections, broadcasts messages, and handles disconnections gracefully. The client connects to the server and allows users to send and receive messages.\n\n## Features\n* Multiple clients can connect to the server simultaneously.\n* Messages sent by a client are broadcasted to all other connected clients.\n* Pending connection requests are managed using a queue.\n* Disconnections are handled gracefully, and pending connections are processed.\n\n## Technologies Used\n* _C++:_ The primary programming language used for implementing the server and client.\n* _Winsock API:_ Used for socket programming to manage network communications.\n* _Multithreading:_ Used in the client code to handle message sending and receiving concurrently.\n\n## Important Notes\n1. _Environment:_ This project is designed to run on Windows, using the Winsock API for socket programming. Ensure you have the Windows SDK installed.\n2. _Development Tools:_ Use Visual Studio for compiling and running the code. Visual Studio provides the necessary environment for compiling Winsock applications.\n3. _Pending Connections:_ The server maintains a queue of pending connections when the maximum client limit is reached. Once a client disconnects, a pending connection is processed.\n4. _Graceful Disconnection:_ Both server and client handle disconnections gracefully, ensuring resources are cleaned up properly.\n5. _Linker Settings:_ Make sure to add wsock32.lib in the Project Properties -\u003e Linker -\u003e Input section. This is necessary for the code to work properly.\n\n## Project Structure\n* _Server Code:_ Manages client connections, receives and broadcasts messages.\n* _Client Code:_ Connects to the server, sends messages, and receives from other clients.\n\n\n## Server Code\nThe server code initializes Winsock, creates a socket, binds it to a port, and listens for incoming connections. It uses a select call to handle multiple client connections and broadcasts messages received from any client to all other connected clients.\n\n## Client Code\nThe client code connects to the server, sends messages typed by the user, and receives broadcasts from the server. It uses a separate thread for receiving messages to allow simultaneous sending and receiving of messages.\n\n## How To Run\n1. _Server:_\n* Open the server code in Visual Studio.\n* Compile and run the server code.\n* The server will start listening on port 9909.\n\n2. _Client:_\n* Open the client code in Visual Studio.\n* Compile and run the client code.\n* Connect to the server by running multiple instances of the client code.\n\n## Example Usage\n1. Start the server.\n2. Run multiple instances of the client code.\n3. Type messages in any client instance and see the messages broadcasted to all other connected clients.\n\n## Future Enhancements\n* _File Transfer:_ Working to add file transfer ability to the chat application for sharing files between clients.\n\n## Conclusions\nThis project demonstrates a basic chat application using sockets and threads in C++. It serves as a foundational example for understanding server-client communication, handling multiple connections, and managing message broadcasting.\n\nFor further enhancements, consider adding features such as user authentication, encryption for secure communication, and a graphical user interface.\n\nFeel free to explore the code and modify it to suit your needs!\n\n*Note:* Please run these codes using Visual Studio and not Visual Studio Code.\n\n## 🚀 About Me\nMy name is Sangeet, and I am currently pursuing BTech in Computer Science and Engineering from IIT Jammu. This project is part of my ongoing efforts to explore and understand network programming and concurrent processing using C++.\n\n## 🔗 Links\n[![linkedin](https://img.shields.io/badge/linkedin-0A66C2?style=for-the-badge\u0026logo=linkedin\u0026logoColor=white)](https://www.linkedin.com/in/sangeet-sangwan-090196258/)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmuszic%2Fchat-application","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmuszic%2Fchat-application","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmuszic%2Fchat-application/lists"}