{"id":18718782,"url":"https://github.com/denis-source/c_server","last_synced_at":"2025-11-10T16:30:20.145Z","repository":{"id":241818080,"uuid":"807321951","full_name":"Denis-Source/c_server","owner":"Denis-Source","description":"Simple TCP server written in C","archived":false,"fork":false,"pushed_at":"2024-05-30T00:15:55.000Z","size":904,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-28T11:12:09.597Z","etag":null,"topics":["c","mqueue","multithreading","posix","tcp"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Denis-Source.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-05-28T22:04:07.000Z","updated_at":"2024-05-30T00:15:58.000Z","dependencies_parsed_at":null,"dependency_job_id":"16577600-920f-4d82-afc5-80acc4c9698e","html_url":"https://github.com/Denis-Source/c_server","commit_stats":null,"previous_names":["denis-source/c_server"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Denis-Source%2Fc_server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Denis-Source%2Fc_server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Denis-Source%2Fc_server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Denis-Source%2Fc_server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Denis-Source","download_url":"https://codeload.github.com/Denis-Source/c_server/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239581759,"owners_count":19662960,"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":["c","mqueue","multithreading","posix","tcp"],"created_at":"2024-11-07T13:23:00.459Z","updated_at":"2025-11-10T16:30:20.100Z","avatar_url":"https://github.com/Denis-Source.png","language":"C","readme":"# Simple TCP server written in C\n\n\u003cimg src=\"https://github.com/Denis-Source/c_server/assets/58669569/45eb5fc6-c732-412e-be0f-d4418c6c2623\" width=\"100%\"\u003e\n\n\u003e Can be used with `netcat` or `telnet`\n\n## Project Overview:\n\nThe project aims to develop a simple chat application that can handle incoming connections, manage client-server communication, and process messages efficiently using multithreading and message queues.\n\n## Key Components:\n1. **Server Context**:\n    - Manages the state of the server, including the key-value table of connections and the buffer of recent messages.\n2. **Connection Management**:\n    - Provides functions for initializing, handling, and closing client connections.\n3. **Message Handling**:\n    - Defines message structures and functions for processing incoming and outgoing messages.\n4. **Multithreading**:\n    - Utilizes pthreads for concurrent execution of tasks, such as listening for incoming connections and handling client requests.\n5. **Message Queues**:\n    - Implements message queues for inter-thread communication, allowing seamless message passing between different components of the server.\n\n## Workflow:\n1. **Initialization**:\n    - The server initializes its context, establishes a message queue for communication, and sets up data structures for connection and message management.\n2. **Connection Acceptance**:\n    - The server listens for incoming connections and accepts them using a listener thread.\n3. **Message Handling**\n    - Incoming messages from clients are processed using message queues.\n    - Message content is decoded and appropriate actions are taken based on the message type.\n4. **Response Generation**:\n    - Upon receiving messages, the server generates appropriate responses and sends them back to clients or performs necessary actions.\n5. **Termination**:\n    - The server gracefully shuts down, freeing resources and closing connections before exiting.\n\n## Technologies Used:\n- **C Programming Language**: Core server logic is implemented in C for low-level control and performance optimization.\n- **POSIX Threads (pthreads)**: Multithreading capabilities are leveraged using pthreads for concurrent execution of tasks.\n- **Message Queues (POSIX mq)**: Inter-thread communication is facilitated through message queues, enabling seamless message passing between components.\n\n## Target Environment:\n- The server application is designed to run in a POSIX-compliant environment, such as Unix-like operating systems (e.g., Linux).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdenis-source%2Fc_server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdenis-source%2Fc_server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdenis-source%2Fc_server/lists"}