{"id":26085156,"url":"https://github.com/kallistina/voting-system-server","last_synced_at":"2026-04-20T11:36:04.826Z","repository":{"id":281195406,"uuid":"944517100","full_name":"Kallistina/voting-system-server","owner":"Kallistina","description":"🗳️ A multi-threaded voting system with a network server, batch client, and automation scripts. Features thread synchronization, socket programming, and safe termination handling. ","archived":false,"fork":false,"pushed_at":"2025-03-07T14:00:06.000Z","size":0,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-07T14:33:27.309Z","etag":null,"topics":["client-server","linux","multi-threading","network-server","poller","socket-programming","system-programming","voting-system"],"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/Kallistina.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":"2025-03-07T13:39:55.000Z","updated_at":"2025-03-07T14:00:10.000Z","dependencies_parsed_at":"2025-03-07T14:43:29.910Z","dependency_job_id":null,"html_url":"https://github.com/Kallistina/voting-system-server","commit_stats":null,"previous_names":["kallistina/voting-system-server"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kallistina%2Fvoting-system-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kallistina%2Fvoting-system-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kallistina%2Fvoting-system-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kallistina%2Fvoting-system-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Kallistina","download_url":"https://codeload.github.com/Kallistina/voting-system-server/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242650909,"owners_count":20163610,"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":["client-server","linux","multi-threading","network-server","poller","socket-programming","system-programming","voting-system"],"created_at":"2025-03-09T05:34:18.319Z","updated_at":"2026-04-20T11:36:04.784Z","avatar_url":"https://github.com/Kallistina.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MultiThreaded Voting System\n\n## Overview\nThis project implements a multi-threaded voting system consisting of:\n- A **multi-threaded network server** (`poller`) that manages incoming votes.\n- A **batch client** (`pollSwayer`) to simulate voters submitting votes.\n- Various **Bash scripts** to automate vote generation, tallying, and log processing.\n\nThe system ensures proper handling of client-server communication, thread synchronization, and data consistency.\n\n---\n\n## Installation \u0026 Compilation\n### Compile the Project\n```bash\nmake\n```\n\n### Run the Multi-threaded Server\n```bash\n./poller 5634 8 16 pollLog.txt pollStats.txt\n```\n- `5634`: Server port\n- `8`: Number of worker threads\n- `16`: Buffer size\n- `pollLog.txt`: Log file\n- `pollStats.txt`: Output file for election results\n\n### Run the Batch Client\n```bash\n./pollSwayer linux01.di.uoa.gr 5634 inputFile.txt\n```\n- Connects to `poller` and submits votes read from `inputFile.txt`\n\n---\n\n## Project Structure\n### **Source Files**\n#### **Multi-threaded Network Server (poller)**\n- **`poller.cpp`**  \n  Implements the server logic, including handling incoming connections and processing votes.\n- **`headFile.h`**  \n  Contains all necessary headers, definitions, function prototypes, and structures.\n\n#### **Batch Client (pollSwayer)**\n- **`pollSwayer.cpp`**  \n  Simulates multiple clients sending votes to the server.\n\n#### **Bash Scripts for Automation**\n- **`create_input.sh`**  \n  Generates random voter data for testing.\n- **`tallyVotes.sh`**  \n  Counts votes and outputs sorted results.\n- **`processLogFile.sh`**  \n  Processes server logs to extract election results.\n\n---\n\n## Functionality\n### **1. Multi-threaded Server (`poller`)**\n- Listens for client connections.\n- Accepts voter names and votes.\n- Checks if a voter has already voted.\n- Updates vote counts and logs votes.\n- Supports safe termination (`CTRL+C`) while saving results.\n\n### **2. Batch Client (`pollSwayer`)**\n- Reads voter data from `inputFile.txt`.\n- Creates threads for each voter to send votes to `poller`.\n- Handles server responses and detects duplicate votes.\n\n### **3. Bash Scripts**\n#### **`create_input.sh`**\n- Generates an input file with simulated voter data.\n```bash\n./create_input.sh politicalParties.txt numLines\n```\n#### **`tallyVotes.sh`**\n- Removes duplicate votes and tallies results.\n```bash\n./tallyVotes.sh tallyResultsFile\n```\n#### **`processLogFile.sh`**\n- Processes server logs to extract results.\n```bash\n./processLogFile.sh poll-log\n```\n\u003e **Note:** The script expects `poll-log` but test cases may use `log.txt`. Modify accordingly.\n\n---\n\n## Notes \u0026 Considerations\n- Ensure correct permissions for Bash scripts:\n  ```bash\n  chmod 777 scriptName.sh\n  ```\n- The server logs election results in `pollStats.txt`.\n- The project correctly handles multiple concurrent voters.\n- Duplicate votes are rejected.\n\n---\n\n## License\nThis project is open-source. Feel free to use, modify, and distribute it as needed.\n\n---\n\nThank you for exploring this project! 🚀\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkallistina%2Fvoting-system-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkallistina%2Fvoting-system-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkallistina%2Fvoting-system-server/lists"}