{"id":27993962,"url":"https://github.com/ahmeddwalid/dsssockets","last_synced_at":"2025-05-08T19:04:42.652Z","repository":{"id":281590888,"uuid":"945740166","full_name":"ahmeddwalid/DSSsockets","owner":"ahmeddwalid","description":"Distributed Systems Security - Assignment 1 (Part 1)","archived":false,"fork":false,"pushed_at":"2025-03-10T04:12:25.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-08T19:04:20.112Z","etag":null,"topics":["client-server","error-handling","ipv4-address","java","multithreading","oop","palindrome-checker","reverse-strings","sockets","string-manipulation","threads"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ahmeddwalid.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":"2025-03-10T03:42:27.000Z","updated_at":"2025-03-25T19:07:56.000Z","dependencies_parsed_at":"2025-03-10T05:23:13.904Z","dependency_job_id":"2412db69-05dc-43c5-b398-bfc651819849","html_url":"https://github.com/ahmeddwalid/DSSsockets","commit_stats":null,"previous_names":["ahmeddwalid/dsssockets"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahmeddwalid%2FDSSsockets","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahmeddwalid%2FDSSsockets/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahmeddwalid%2FDSSsockets/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahmeddwalid%2FDSSsockets/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ahmeddwalid","download_url":"https://codeload.github.com/ahmeddwalid/DSSsockets/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253133137,"owners_count":21859111,"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","error-handling","ipv4-address","java","multithreading","oop","palindrome-checker","reverse-strings","sockets","string-manipulation","threads"],"created_at":"2025-05-08T19:04:41.883Z","updated_at":"2025-05-08T19:04:42.563Z","avatar_url":"https://github.com/ahmeddwalid.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch2 align=\"center\"\u003eDistributed Systems Security\u003c/h2\u003e\n\u003ch3 align=\"center\"\u003eAhmed Walid\u003c/h3\u003e\n\n\u003cp align=\"center\"\u003e\n    Cross Platform Java server and Client using sockets\n    \u003cbr /\u003e\n    \u003ca href=\"https://github.com/ahmeddwalid/DSSsockets/blob/main/README.md\"\u003e\u003cstrong\u003eExplore the docs »\u003c/strong\u003e\u003c/a\u003e\n    \u003cbr /\u003e\n    \u003cbr /\u003e\n    \u003ca href=\"https://github.com/ahmeddwalid/DSSsockets/issues\"\u003eReport Bug\u003c/a\u003e\n    ·\n    \u003ca href=\"https://github.com/ahmeddwalid/DSSsockets/pulls\"\u003eRequest Feature\u003c/a\u003e\n\u003c/p\u003e\n\n\u003c!-- ABOUT THE PROJECT --\u003e\n## About The Project\n\nThis Project consists of two parts:\n1. **Server**: Having two functions:\n   - Checking if a string is a palindrome\n   - Reversing a string\n\n2. **Client**: Connects to the server, sends requests, and displays results.\n\n\u003c!-- FEATURES --\u003e\n## Features\n\n- Configurable Network Settings\n- Multithreaded server\n- Input Validation\n- Error Handling\n- Isolated client handling failures (one client error won't affect other clients)\n- **Clean code**\n\n\u003c!-- Prerequisites  --\u003e\n## Prerequisites\n\n- Java Development Kit (JDK) 8 or higher\n- IntelliJ IDEA IDE (recommended)\n\n\u003c!-- Server Implementation--\u003e\n## Server Implementation\n\nThe server listens for client connections and processes string manipulation requests.\n\nFeaturing:\n\n1. **Configurable Port**:\n   - The user can choose to use the default port (8888) or specify a custom port (1024-65535).\n   - Validates user input to ensure the port is within valid range.\n\n2. **Multithreaded Architecture**:\n   - Each client connection is handled in a separate thread by the `ClientHandler` class.\n   - Allows the server to handle multiple clients simultaneously without blocking.\n\n3. **Network Information Display**:\n   - Shows the server's IP address when started, making it easier for clients whom are on different machine to connect.\n     **Note:** If the client and the server are on the same machine, use localhost or any loopback IP address actually (127.0.0.0/8)\n\n4. **String Manipulation Functions**:\n   - **Palindrome Check**: Checks if a string reads the same backward as forward.\n      - Returns \"1\" for palindromes, \"0\" for non-palindromes.\n      - Ignores spaces and isn't case-sensitive for easier use.\n   - **String Reversal**: Reverses the input string.\n      - Uses Java's StringBuilder for efficient string manipulation.\n\n5. **Error Handling**:\n   - Socket binding errors\n   - Connection acceptance errors (ex: if the port is already in use or if there are firewall restrictions)\n   - Client communication errors\n   - Invalid input handling\n\n## The Server's sequence\n1. The server starts and prompts for port configuration.\n2. After binding to the port, it displays its IP address and waits for client connections.\n3. When a client connects, a new thread is created to handle that client.\n4. The handler thread:\n   - Reads the function choice (1 or 2)\n- Reads the input string\n- Processes the request based on the choice\n- Sends the result back to the client\n- Closes the connection\n5. The main server thread continues listening for new connections.\n\n\u003c!-- Client Implementation--\u003e\n## Client Implementation\n\nThe client connects to the server, sends requests and displays results.\n\nFeaturing:\n\n1. **Configurable Connection Settings**:\n   - **Server Address**: Use localhost (default) or specify a custom IP address.\n   - **Server Port**: Use default port (5555) or specify a custom port.\n\n2. **User Interaction**:\n   - Clear and formatted output of results.\n\n3. **Operation Modes**:\n   - **Palindrome Check**: Displays whether the string is a palindrome.\n   - **String Reversal**: Shows the reversed string.\n\n4. **Error Handling**:\n   - Connection failures\n   - Invalid server address\n   - Invalid port numbers\n   - Server communication errors\n   - Input validation\n\n## Runtime\n\n#### Server Side:\n```  \nString Operations Server Setup  \n-----------------------------  \nUse default port (5555)? (Y/n): y  \nServer started on port 8888  \nServer IP address: 192.168.57.1\nWaiting for clients...  \nClient connected: 127.0.0.1  \nClient disconnected  \n```  \n\n#### Client Side:\n```  \nString Operations Client  \n------------------------  \nServer connection setup:  \nUse localhost (default)? (Y/n): n  \nEnter server IP address: 127.0.0.1  \nUse default port (5555)? (Y/n): y  \nConnecting to server at 127.0.0.1:5555...  \nConnected to server.  \nChoose an operation:  \n1. Check if a string is a palindrome  \n2. Reverse a string  \nEnter your choice (1 or 2): 1  \nEnter a string: Ahmed  \nResult: \"Ahmed\" is not a palindrome.  \n```\n\n\u003c!-- CONTRIBUTING --\u003e\n# Contributing\n\nProject's Link: [https://github.com/ahmeddwalid/DSSsockets](https://github.com/ahmeddwalid/DSSsockets)\n\nAny contributions you make are **greatly appreciated**.\n\nFeatures to be implemented:\n- **Security:**\n   - Adding authentication for client connections\n   - Implementing encryption for data transmission\n   - Adding server system logs\n\n- **User Interface:** A long stretch but a GUI possibly?\n\n### How to Contribute:\n\nIf you'd like to contribute, please follow these steps:\n\n-  **Fork the repository:** Create your own copy of the project.\n-  **Create a branch:** `git checkout -b feature/your-feature-name`\n-  **Make your changes:** Implement your contribution.\n-  **Commit your changes:** `git commit -m \"Add your descriptive commit message\"`\n-  **Push to the branch:** `git push origin feature/your-feature-name`\n-  **Create a pull request:** Submit your changes for review.\n\n### Contribution Guidelines\n\n- Write clear and concise commit messages.\n- Provide detailed explanations in your pull requests.\n- Be respectful and considerate of other contributors.\n\n\nThank you for your contributions!\n\n\n\u003c!-- LICENSE --\u003e\n# License\n\nThis project is distributed under the [Apache 2.0 license](https://choosealicense.com/licenses/apache-2.0/). See\n[```LICENSE.txt```](/LICENSE) for more information.\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fahmeddwalid%2Fdsssockets","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fahmeddwalid%2Fdsssockets","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fahmeddwalid%2Fdsssockets/lists"}