{"id":25171246,"url":"https://github.com/basemax/windows-linux-file-downloader-c","last_synced_at":"2025-04-03T21:20:44.268Z","repository":{"id":255881100,"uuid":"852224906","full_name":"BaseMax/windows-linux-file-downloader-c","owner":"BaseMax","description":"File Downloader in C: A simple C program to download files over HTTP using sockets. Cross-platform support for both Windows and Linux.","archived":false,"fork":false,"pushed_at":"2024-09-07T14:40:23.000Z","size":25,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-28T17:08:10.482Z","etag":null,"topics":["c","clang","download-file","file-downloader","http","http-download","http-file-download","network","socket"],"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/BaseMax.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-09-04T12:51:31.000Z","updated_at":"2024-09-07T14:41:24.000Z","dependencies_parsed_at":"2024-09-07T17:13:57.993Z","dependency_job_id":"b9ae151d-c84b-4b0c-9022-be49d82cef19","html_url":"https://github.com/BaseMax/windows-linux-file-downloader-c","commit_stats":null,"previous_names":["basemax/windows-linux-file-downloader-c"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BaseMax%2Fwindows-linux-file-downloader-c","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BaseMax%2Fwindows-linux-file-downloader-c/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BaseMax%2Fwindows-linux-file-downloader-c/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BaseMax%2Fwindows-linux-file-downloader-c/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BaseMax","download_url":"https://codeload.github.com/BaseMax/windows-linux-file-downloader-c/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247079198,"owners_count":20880015,"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","clang","download-file","file-downloader","http","http-download","http-file-download","network","socket"],"created_at":"2025-02-09T09:19:40.868Z","updated_at":"2025-04-03T21:20:44.235Z","avatar_url":"https://github.com/BaseMax.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Windows/Linux File Downloader in C\n\nA C program that demonstrates how to download a file over HTTP from a server using sockets. The program is cross-platform, working on both Windows and Linux systems.\n\n## Features\n\n- **Cross-platform support:** Works on both Windows and Linux.\n- **Socket:** Uses sockets to connect to a server and download a file.\n- **Minimal dependencies:** Only standard C libraries and platform-specific socket libraries are used.\n\n## Requirements\n\n### Windows\n\n- GCC (MinGW or similar)\n- Winsock2 library (comes with Windows)\n\n### Linux\n\n- GCC\n- Standard POSIX libraries (usually included with most Linux distributions)\n\n## Building the Project\n\n### Windows\n\nTo build the program on Windows, use the following command:\n\n```bash\ngcc downloader.c -o downloader -g -Wextra -std=c11 -lws2_32\n```\n\n### Linux\n\nTo build the program on Linux, use the following command:\n\n```bash\ngcc downloader.c -o downloader -g -Walloca -Wextra -Wall -fsanitize=address,undefined -std=c11\n```\n\n## Usage\n\nAfter compiling, you can run the program as follows:\n\n```bash\n./downloader\n```\n\nThe program will connect to example.com and download the file located on remote server, saving it locally as `downloaded_file.log`.\n\n### Customization\n\n- **Hostname:** The hostname to connect to is currently set to example.com.\n- **Path:** The path to the file on the server is set to /file.txt.\n- **Port:** The port used for the connection is 80 (HTTP).\n\nYou can customize these values by modifying the following lines in downloader.c:\n\n```c\nconst char *hostname = \"example.com\";\nconst char *path = \"/file.txt\";\nconst char *port = \"80\";\n```\n\n### Platform-Specific Notes\n\n#### Windows\n\nThe program uses Winsock2 for socket communication. Ensure that Winsock2 is initialized using WSAStartup() before any socket operations and cleaned up using WSACleanup() after all operations are done.\n\n#### Linux\n\nThe program uses POSIX-compliant socket functions and does not require any special initialization or cleanup beyond the normal opening and closing of sockets.\n\n## Troubleshooting\n\n- Socket Connection Issues: Ensure that the server you are trying to connect to is reachable and that the port is open.\n- Compilation Errors: Make sure you are using GCC with the appropriate flags as described in the \"Building the Project\" section.\n- File Writing Issues: Ensure that you have write permissions to the directory where the file will be saved.\n\n### Author\n\nMax Base\n\n### License\n\nThis project is licensed under the GPL-3.0 License. See the LICENSE file for more details.\n\nCopyright 2024, Max Base\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbasemax%2Fwindows-linux-file-downloader-c","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbasemax%2Fwindows-linux-file-downloader-c","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbasemax%2Fwindows-linux-file-downloader-c/lists"}