{"id":18985182,"url":"https://github.com/potatomaster101/netutil","last_synced_at":"2025-08-22T07:38:57.743Z","repository":{"id":115197686,"uuid":"202549483","full_name":"PotatoMaster101/netutil","owner":"PotatoMaster101","description":"Some code for socket programming and IO","archived":false,"fork":false,"pushed_at":"2021-11-26T12:47:59.000Z","size":5,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-16T07:14:04.710Z","etag":null,"topics":["c","mit-license","networking","socket","socket-programming"],"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/PotatoMaster101.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":"2019-08-15T13:49:12.000Z","updated_at":"2021-11-26T12:48:03.000Z","dependencies_parsed_at":"2023-05-12T05:45:52.605Z","dependency_job_id":null,"html_url":"https://github.com/PotatoMaster101/netutil","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/PotatoMaster101/netutil","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PotatoMaster101%2Fnetutil","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PotatoMaster101%2Fnetutil/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PotatoMaster101%2Fnetutil/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PotatoMaster101%2Fnetutil/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PotatoMaster101","download_url":"https://codeload.github.com/PotatoMaster101/netutil/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PotatoMaster101%2Fnetutil/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271605883,"owners_count":24788968,"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","status":"online","status_checked_at":"2025-08-22T02:00:08.480Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","mit-license","networking","socket","socket-programming"],"created_at":"2024-11-08T16:25:04.250Z","updated_at":"2025-08-22T07:38:57.712Z","avatar_url":"https://github.com/PotatoMaster101.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NetUtil\nUtil functions for socket programming in C. Originally used in uni assignments.\n\n## Compile\nCompile with `-std=gnu99` flag.\n```\ngcc *.c -std=gnu99\n```\n\n## Example\n**Server**:\n```c\n#include \"netutil.h\"\n\n// server config\nconst char port[] = \"1234\";\n\nint main(void) {\n    struct addrinfo hints = tcphints(AF_UNSPEC, AI_PASSIVE), *res;\n    getaddrinfo(NULL, port, \u0026hints, \u0026res);\n\n    int sockfd = addrsock(res);\n    addrbind(sockfd, res);\n    addrreuse(sockfd);\n    freeaddrinfo(res);\n\n    struct sockaddr_storage remote;\n    socklen_t rsize = sizeof remote;\n    listen(sockfd, 10);\n    int accfd = accept(sockfd, TOSADDR(\u0026remote), \u0026rsize);\n    // do network stuff with accfd\n    return 0;\n}\n```\n\n**Client**:\n```c\n#include \"netutil.h\"\n\n// remote server config\nconst char addr[] = \"192.168.1.1\";\nconst char port[] = \"1234\";\n\nint main(void) {\n    struct addrinfo hints = tcphints(AF_UNSPEC, AI_PASSIVE), *res;\n    getaddrinfo(addr, port, \u0026hints, \u0026res);\n\n    int sockfd = addrsock(res);\n    addrconn(sockfd, res);\n    freeaddrinfo(res);\n    // do network stuff with sockfd\n    return 0;\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpotatomaster101%2Fnetutil","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpotatomaster101%2Fnetutil","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpotatomaster101%2Fnetutil/lists"}