{"id":26428954,"url":"https://github.com/brokenprogrammer/mnet","last_synced_at":"2025-10-08T01:58:17.019Z","repository":{"id":81706184,"uuid":"461013907","full_name":"brokenprogrammer/mnet","owner":"brokenprogrammer","description":"Win32 Event Based Networking Library","archived":false,"fork":false,"pushed_at":"2022-02-19T09:05:50.000Z","size":24,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-08T01:58:16.476Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/brokenprogrammer.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-02-18T21:42:32.000Z","updated_at":"2022-02-20T11:32:08.000Z","dependencies_parsed_at":null,"dependency_job_id":"ed2f3129-74d4-4700-a04f-9cf3609d5be0","html_url":"https://github.com/brokenprogrammer/mnet","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/brokenprogrammer/mnet","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brokenprogrammer%2Fmnet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brokenprogrammer%2Fmnet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brokenprogrammer%2Fmnet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brokenprogrammer%2Fmnet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/brokenprogrammer","download_url":"https://codeload.github.com/brokenprogrammer/mnet/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brokenprogrammer%2Fmnet/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278877086,"owners_count":26061380,"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-10-07T02:00:06.786Z","response_time":59,"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":[],"created_at":"2025-03-18T04:52:41.277Z","updated_at":"2025-10-08T01:58:17.014Z","avatar_url":"https://github.com/brokenprogrammer.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mnet\n\nMNet is an event based networking library built on top of Winsock Overlapped (Asynchronous) I/O.\n\n## Usage\n\nIn order to use MNet you use the existing [mnet.h](mnet.h?raw=1) and [mnet.c](mnet.c?raw=1) files. Since it is a windows library you also have to link with `ws2_32`.\n\nUsage examples can be found within the [examples](examples/) folder.\n\n## Server Example\n\nA bare bones TCP echo server that listens to port 5000 and echoes all messages back to clients.\n\n```C\n#include \"../mnet.h\"\n\n#include \"util.c\"\n#include \"../mnet.c\"\n\n#pragma comment (lib, \"ws2_32.lib\")\n\nint main()\n{\n    MNetInitialize();\n    mnet_sock Server = MNetCreateSocket();\n    MNetListen(\u0026Server, 8000);\n\n    while (Server.State == MNET_SOCK_STATE_LISTENING)\n    {\n        MNetUpdate(\u0026Server);\n\n        if (Server.NumberOfEvents == 0)\n        {\n            continue;\n        }\n\n        char Buffer[4096];\n        for (int Index = 0; Index \u003c Server.NumberOfEvents; ++Index)\n        {\n            mnet_event Event = Server.Events[Index];\n\n            switch(Event.Type)\n            {\n                case MNET_EVENT_TYPE_ACCEPT:\n                {\n                    MNetRecieve(Event.Connection);\n                } break;\n\n                case MNET_EVENT_TYPE_RECEIVED:\n                {\n                    sprintf_s(Buffer, 4096, \"%s\", Event.Connection-\u003eBuffer);\n                    MNetSend(Event.Connection, Buffer, strlen(Buffer));\n                } break;\n\n                case MNET_EVENT_TYPE_SENT:\n                {\n                    MNetRecieve(Event.Connection);\n                } break;\n            }\n        }\n    }\n}\n```\n\n## Client Example\n\nA simple client example that connects to a server and sends an incremented test message.\n\n```C\n#include \"../mnet.h\"\n\n#include \"util.c\"\n#include \"../mnet.c\"\n\n#pragma comment (lib, \"ws2_32.lib\")\n\nint main()\n{\n    MNetInitialize();\n    mnet_sock Client = MNetCreateSocket();\n    MNetConnect(\u0026Client, \"127.0.0.1\", 5000);\n\n    unsigned int Number = 1;\n    char Buffer[1024];\n\n    while (Client.State == MNET_SOCK_STATE_CONNECTED)\n    {\n        MNetUpdate(\u0026Client);\n\n        if (Client.NumberOfEvents == 0)\n        {\n            continue;\n        }\n\n        for (int Index = 0; Index \u003c Client.NumberOfEvents; ++Index)\n        {\n            mnet_event Event = Client.Events[Index];\n\n            switch(Event.Type)\n            {\n                case MNET_EVENT_TYPE_CONNECT:\n                {\n                    sprintf_s(Buffer, 1024, \"%s%d\\r\\n\", \"Test Number \", Number++);\n                    MNetSend(Event.Connection, Buffer, strlen(Buffer));\n                } break;\n\n                case MNET_EVENT_TYPE_RECEIVED:\n                {\n                    sprintf_s(Buffer, 1024, \"%s%d\\r\\n\", \"Test Number \", Number++);\n                    MNetSend(Event.Connection, Buffer, strlen(Buffer));\n                } break;\n\n                case MNET_EVENT_TYPE_SENT:\n                {\n                    MNetRecieve(Event.Connection);             \n                } break;\n            }\n        }\n    }\n}\n```\n\n## License\n\nMIT License\n\nCopyright (c) 2022 Oskar Mendel\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrokenprogrammer%2Fmnet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrokenprogrammer%2Fmnet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrokenprogrammer%2Fmnet/lists"}