{"id":19779577,"url":"https://github.com/maluoi/warm-sock","last_synced_at":"2025-08-16T11:09:03.975Z","repository":{"id":47352546,"uuid":"272611261","full_name":"maluoi/warm-sock","owner":"maluoi","description":"A single header high-level socket/networking library for building ad-hoc server/client multi-user experiences.","archived":false,"fork":false,"pushed_at":"2020-06-18T06:49:22.000Z","size":154,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-30T21:39:26.696Z","etag":null,"topics":["c","networking","single-header","sockets"],"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/maluoi.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}},"created_at":"2020-06-16T04:42:25.000Z","updated_at":"2022-07-20T19:04:54.000Z","dependencies_parsed_at":"2022-08-22T01:20:53.382Z","dependency_job_id":null,"html_url":"https://github.com/maluoi/warm-sock","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/maluoi/warm-sock","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maluoi%2Fwarm-sock","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maluoi%2Fwarm-sock/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maluoi%2Fwarm-sock/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maluoi%2Fwarm-sock/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maluoi","download_url":"https://codeload.github.com/maluoi/warm-sock/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maluoi%2Fwarm-sock/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270702562,"owners_count":24630877,"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-16T02:00:11.002Z","response_time":91,"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","networking","single-header","sockets"],"created_at":"2024-11-12T05:35:11.771Z","updated_at":"2025-08-16T11:09:03.951Z","avatar_url":"https://github.com/maluoi.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# warm-sock\n![warm_sock logo](img/warm_sock_logo_wide.png)\n\nA single header high-level socket/networking library for building server/client multi-user experiences.\n\nStill in development, more info to follow! This is designed to be the networking component of [StereoKit](https://stereokit.net), so it needs to be able to handle networking scenarios common to shared Mixed Reality experiences.\n\n## Features\n\n- [x] Simple API\n- [x] Server/Client architecture\n- [x] LAN discovery\n- [x] Non-blocking core loop\n- [x] Send to one/send to all\n- [x] Connect/disconnect events\n- [x] Easy send/receive structs\n- [ ] Server can be transferred to a client\n- [ ] Send large data\n\n## Example usage\n\nFor full example, see [example.cpp](example.cpp). But here's a quick taste of the core experience!\n\n```C\n// Set up our callback functions\nsock_on_connection(on_connection);\nsock_on_receive([](sock_header_t header, const void *data) {\n    switch (header.data_id) {\n    case sock_hash_type(test_data_t): {\n\n        const test_data_t *test = (const test_data_t *)data;\n        printf(\"test_data_t: [%.2f, %.2f, %.2f], [%.2f, %.2f, %.2f]\\n\",\n            test-\u003eposition [0], test-\u003eposition [1], test-\u003eposition [2],\n            test-\u003edirection[0], test-\u003edirection[1], test-\u003edirection[2]);\n\n    }\n    default: break;\n    }\n});\n\n// Set up warm_sock\nif (!sock_init(sock_hash(\"Warm sock example\"), 27015)) return 0;\n\n// Connect to a server if we find one. If not, make our own server!\nchar addr[32];\nif (sock_find_server(addr, sizeof(addr))) {\n    printf(\"Connecting to server at %s\\n\", addr);\n    if (!sock_start_client(addr)) return 0;\n} else {\n    printf(\"Starting a server!\\n\");\n    if (!sock_start_server()) return 0;\n}\n\n// Poll for network events until it crashes or we get bored!\nwhile (sock_poll()) {\n    if (_kbhit() != 0) {\n\n        // Send a message using a struct\n        test_data_t test = { {1, 2, 3}, {3, 2, 1} };\n        sock_send(sock_hash_type(test_data_t), sizeof(test), \u0026test);\n\n    }\n    Sleep(1);\n}\n\nsock_shutdown();\n```\n\n## License\n\nMIT or Public Domain. See bottom of warm_sock.h for details.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaluoi%2Fwarm-sock","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaluoi%2Fwarm-sock","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaluoi%2Fwarm-sock/lists"}