{"id":24857169,"url":"https://github.com/adrianmosnegutu/multiplexed-chat-server","last_synced_at":"2026-05-18T03:32:34.501Z","repository":{"id":264082551,"uuid":"892159175","full_name":"AdrianMosnegutu/Multiplexed-Chat-Server","owner":"AdrianMosnegutu","description":"A group chat server that broadcasts messages sent by one client to all connected clients.","archived":false,"fork":false,"pushed_at":"2024-12-28T14:00:44.000Z","size":36,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-31T17:15:33.295Z","etag":null,"topics":["broadcast","c","computer-networking","group-chat","linux","socket-programming","tcp-client","tcp-server","tcp-socket"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AdrianMosnegutu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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-11-21T15:58:17.000Z","updated_at":"2024-12-28T14:00:48.000Z","dependencies_parsed_at":"2024-12-28T15:17:19.334Z","dependency_job_id":"fa80f9f4-cc89-4724-918f-6b84e9b0ec0f","html_url":"https://github.com/AdrianMosnegutu/Multiplexed-Chat-Server","commit_stats":null,"previous_names":["adrianmosnegutu/multiplexed-chat-server"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AdrianMosnegutu%2FMultiplexed-Chat-Server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AdrianMosnegutu%2FMultiplexed-Chat-Server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AdrianMosnegutu%2FMultiplexed-Chat-Server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AdrianMosnegutu%2FMultiplexed-Chat-Server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AdrianMosnegutu","download_url":"https://codeload.github.com/AdrianMosnegutu/Multiplexed-Chat-Server/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245683300,"owners_count":20655537,"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":["broadcast","c","computer-networking","group-chat","linux","socket-programming","tcp-client","tcp-server","tcp-socket"],"created_at":"2025-01-31T17:15:34.695Z","updated_at":"2026-05-18T03:32:29.463Z","avatar_url":"https://github.com/AdrianMosnegutu.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Multiplexed Chat Server\n\n## Overview\n\nThis project is a multi-client TCP-based group chat application built in C. It includes both a server and client implementation, enabling real-time communication between multiple users over a network. The server employs efficient I/O multiplexing using the select system call, while the client offers a simple interface for connecting to the server and participating in the chat. Shared utility functions are included for streamlined socket management.\n\n## Features\n\n### Server Features\n\n- **Concurrent Client Connections**: Manages multiple clients simultaneously using a single-threaded approach with select.\n- **Real-Time Messaging**: Broadcasts messages from any client to all other connected clients efficiently.\n- **Dynamic Client Management**: \n    - Handles new connections dynamically.\n    - Removes inactive or disconnected clients gracefully.\n- **Server-Side Commands**:\n    - quit: Shuts down the server and disconnects all clients.\n- **Comprehensive Error Handling**: Ensures stability and clean shutdown during unexpected errors.\n\n### Client Features\n\n- **User Authentication**: Allows users to set a username when connecting to the server.\n- **Real-Time Chat**: Sends messages to the server for broadcasting to other connected clients.\n- **Interactive Interface**:\n\t- Displays incoming messages in real-time.\n\t- Supports text input for sending messages.\n- **Disconnection Handling**: Handles clean disconnection from the server when a client exits or the server shuts down.\n\n### Shared Utilities\n\n- **Socket Utilities**: Common functions for socket creation, error handling, and IPv4 address initialization, shared between the server and client.\n\n\n## How it works\n\n1. **Server**\n\n- Initializes a TCP socket, binds it to a specified port, and begins listening for incoming client connections.\n- Manages incoming and outgoing messages and broadcasts them to all connected clients.\n\n2. **Client**\n\n- Connects to the server using the server’s IP and port.\n- Sends a username upon connection, which is announced to other clients.\n- Allows users to send messages and receive real-time updates from other users in the chat.\n\n## Requirements\n\n- **Operating System**: Linux (or any POSIX-compliant system).\n- **Dependencies**:\n\t- gcc (for compilation).\n\t- Basic networking libraries (sys/socket.h, arpa/inet.h, etc.).\n\n## Installation and usage\n\n1. **Clone this repository**\n\n    ``` bash\n    git clone https://github.com/AdrianMosnegutu/Multiplexed-Chat-Server.git\n    cd Multiplexed-Chat-Server\n    ```\n\n2. **Compile the server and client**\n\n    #### Compile the server\n\n    ``` bash\n    gcc -o chat_server server.c utils/server_utils.c utils/general_utils.c \n    ```\n\n    #### Compile the client\n    \n    ``` bash\n    gcc -o chat_client client.c utils/client_utils.c utils/general_utils.c \n    ```\n\n3. **Run the server**\n\n    Start the server to listen for incoming connections:\n    ``` bash\n    ./chat_server\n    ```\n\n4. **Run any number of clients**\n\n    Clients can connect to the server using the compiled client binary:\n    ``` bash\n    ./chat_client\n    ```\n\n## File Structure\n\n- [`utils/`](./utils/)\n    - [`general_utils.h`](./utils/general_utils.h)/[`server_utils.h`](./utils/server_utils.h)/[`client_utils.h`](./utils/client_utils.h): Header files for respective utility functions.\n    - [`general_utils.c`](./utils/general_utils.c): Shared utilities for socket creation, IPv4 address initialization, and error handling.\n    - [`server_utils.c`](./utils/server_utils.c): Utility functions for server-side socket management and error handling.\n    - [`client_utils.c`](./utils/client_utils.c): Utility functions for client-side socket management and input handling.\n- [`server.c`](./server.c): Main server logic, including connection handling and message broadcasting.\n- [`client.c`](./client.c): Main client logic, including server connection, message sending, and receiving.\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](./LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadrianmosnegutu%2Fmultiplexed-chat-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadrianmosnegutu%2Fmultiplexed-chat-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadrianmosnegutu%2Fmultiplexed-chat-server/lists"}