{"id":16607553,"url":"https://github.com/davidgraeff/mdnscpp","last_synced_at":"2026-03-03T15:04:36.626Z","repository":{"id":136770426,"uuid":"262767599","full_name":"davidgraeff/mdnscpp","owner":"davidgraeff","description":"MDNS Service discovery and publish library for C++17","archived":false,"fork":false,"pushed_at":"2024-05-02T14:13:25.000Z","size":77,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-26T05:30:01.284Z","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":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/davidgraeff.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":"2020-05-10T11:00:58.000Z","updated_at":"2024-03-05T14:21:54.000Z","dependencies_parsed_at":null,"dependency_job_id":"1d2b5720-37c9-4425-b8db-0f34f1778085","html_url":"https://github.com/davidgraeff/mdnscpp","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/davidgraeff/mdnscpp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidgraeff%2Fmdnscpp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidgraeff%2Fmdnscpp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidgraeff%2Fmdnscpp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidgraeff%2Fmdnscpp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/davidgraeff","download_url":"https://codeload.github.com/davidgraeff/mdnscpp/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidgraeff%2Fmdnscpp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30050222,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-03T14:38:37.398Z","status":"ssl_error","status_checked_at":"2026-03-03T14:38:06.721Z","response_time":61,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":"2024-10-12T01:23:07.377Z","updated_at":"2026-03-03T15:04:36.582Z","avatar_url":"https://github.com/davidgraeff.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Public domain mDNS/DNS-SD library for C++\n\nThis is a mDNS / service discovery and publish header-only C++17 library.\nOptional parts of C++20 are used (concepts).\n\nThis library is put in the public domain; you can redistribute it and/or modify it without any restrictions.\n\n## Features\n\nThe library does DNS-SD discovery and service as well as single record mDNS query and response.\n\n* Memory management is customizable via templates, with a pre-allocated buffer default implementation.\n* Socket communication is customizable via templates. \n  Either existing BSD Socket API handlers can be used or the library manages sockets for you with the\n  default implementation. The socket is initialized with multicast membership (including loopback) and set to non-blocking mode.\n\n\n## Usage\n\nThe `examples/discovery.cpp` and `examples/publish.cpp` demonstrates the use of all features, including discovery, query and service response.\nBuild this repo with [CMake](https://cmake.org/download/) and find the example executables in your build directory.\n\n### Initialize the library\n\nFirst create a custom type with the features that you require:\n\n```cpp\nusing Mdns = MdnsCpp\u003cMdnsFixedSizeBuffer\u003c3\u003e, MdnsManagedSocket, MdnsThreadSafety\u003e\n```\n\nThe first template argument defines the memory management strategy.\nYou can chose between `MdnsFixedSizeBuffer` and `MdnsDynamicMemory`.\n\nThe second argument is either `MdnsManagedSocket` or a custom type that implements\nthe same methods and sub-types like `MdnsManagedSocket`.\n\n### Discovery\n\nTo send a DNS-SD service discovery request use `mdns.discover()`.\nThis will send a single multicast packet (single question record for `_services._dns-sd._udp.local.`).\n\nUse the returned `Mdns::QueryProcess` type and the method `receive() -\u003e Optional\u003cMdns::QueryProcess\u003e` to query for responses.\nIf there is another record available since the last call, it will be returned.\n\nThe second entry type will be one of `MDNS_ENTRYTYPE_ANSWER`, `MDNS_ENTRYTYPE_AUTHORITY` and `MDNS_ENTRYTYPE_ADDITIONAL`.\n\n### Query\n\nTo send a mDNS query for a single record use `mdns.query(record : string_view)` with `record` = `_http._tcp.local.` for example.\nThis will send a single multicast query packet for the given record with a unique transaction id.\n\nUse the returned `Mdns::QueryProcess` type and the method `receive() -\u003e Optional\u003cMdns::QueryResult\u003e` to query for responses (for the unique transaction id determined earlier).\nIf there is another record available since the last call, it will be returned.\n\nThe second entry type will be one of `MDNS_ENTRYTYPE_ANSWER`, `MDNS_ENTRYTYPE_AUTHORITY` and `MDNS_ENTRYTYPE_ADDITIONAL`.\n\n### Service\n\nIf you use the default socket implementation, using this library in service / publish mode is straight-forward.\n\nCall `mdns.publish(service)` to \n\nTo listen for incoming DNS-SD requests and mDNS queries the socket should be opened on port `5353` (default) in call to the socket open/setup functions. Then call `mdns_socket_listen` either on notification of incoming data, or by setting blocking mode and calling `mdns_socket_listen` to block until data is available and parsed.\n\nThe entry type passed to the callback will be `MDNS_ENTRYTYPE_QUESTION` and record type `MDNS_RECORDTYPE_PTR`. Use the `mdns_record_parse_ptr` function to get the name string of the service record that was asked for.\n\nIf service record name is `_services._dns-sd._udp.local.` you should use `mdns_discovery_answer` to send the records of the services you provide (DNS-SD).\n\nIf the service record name is a service you provide, use `mdns_query_answer` to send the service details back in response to the query.\n\nSee the test executable implementation for more details on how to handle the parameters to the given functions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidgraeff%2Fmdnscpp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavidgraeff%2Fmdnscpp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidgraeff%2Fmdnscpp/lists"}