{"id":13578133,"url":"https://github.com/richardschneider/net-mdns","last_synced_at":"2025-10-25T00:03:58.488Z","repository":{"id":47278609,"uuid":"122793174","full_name":"richardschneider/net-mdns","owner":"richardschneider","description":"Simple multicast DNS","archived":false,"fork":false,"pushed_at":"2024-04-24T09:41:28.000Z","size":1057,"stargazers_count":236,"open_issues_count":28,"forks_count":87,"subscribers_count":18,"default_branch":"master","last_synced_at":"2025-04-08T15:14:22.848Z","etag":null,"topics":["dns","dns-sd","multicast","zero-configuration"],"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/richardschneider.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":"2018-02-25T00:43:28.000Z","updated_at":"2025-03-17T11:58:40.000Z","dependencies_parsed_at":"2024-06-21T02:29:17.953Z","dependency_job_id":null,"html_url":"https://github.com/richardschneider/net-mdns","commit_stats":{"total_commits":214,"total_committers":8,"mean_commits":26.75,"dds":0.03738317757009346,"last_synced_commit":"b9f2f8158052568a19d09536179ceaf5cae9b23e"},"previous_names":[],"tags_count":40,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/richardschneider%2Fnet-mdns","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/richardschneider%2Fnet-mdns/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/richardschneider%2Fnet-mdns/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/richardschneider%2Fnet-mdns/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/richardschneider","download_url":"https://codeload.github.com/richardschneider/net-mdns/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253514643,"owners_count":21920339,"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":["dns","dns-sd","multicast","zero-configuration"],"created_at":"2024-08-01T15:01:27.782Z","updated_at":"2025-10-25T00:03:58.482Z","avatar_url":"https://github.com/richardschneider.png","language":"C#","funding_links":["https://www.buymeacoffee.com/kmXOxKJ4E"],"categories":["C# #"],"sub_categories":[],"readme":"# net-mdns\n\n[![build status](https://ci.appveyor.com/api/projects/status/github/richardschneider/net-mdns?branch=master\u0026svg=true)](https://ci.appveyor.com/project/richardschneider/net-mdns) \n[![travis build](https://travis-ci.org/richardschneider/net-mdns.svg?branch=master)](https://travis-ci.org/richardschneider/net-mdns)\n[![CircleCI](https://circleci.com/gh/richardschneider/net-mdns.svg?style=svg)](https://circleci.com/gh/richardschneider/net-mdns)\n[![Coverage Status](https://coveralls.io/repos/richardschneider/net-mdns/badge.svg?branch=master\u0026service=github)](https://coveralls.io/github/richardschneider/net-mdns?branch=master)\n[![Version](https://img.shields.io/nuget/v/Makaretu.Dns.Multicast.svg)](https://www.nuget.org/packages/Makaretu.Dns.Multicast)\n[![docs](https://cdn.rawgit.com/richardschneider/net-mdns/master/doc/images/docs-latest-green.svg)](https://richardschneider.github.io/net-mdns/articles/intro.html)\n\nA simple Multicast Domain Name Service based on [RFC 6762](https://tools.ietf.org/html/rfc6762).  Can be used \nas both a client (sending queries) or a server (responding to queries).\n\nA higher level DNS Service Discovery based on [RFC 6763](https://tools.ietf.org/html/rfc6763) that automatically responds to any query for the \nservice or service instance.\n\n## Features\n\n- Targets Framework 4.6.1, .NET Standard 1.4 and 2.0\n- Supports IPv6 and IPv4 platforms\n- CI on Circle (Debian GNU/Linux), Travis (Ubuntu Xenial and OSX) and AppVeyor (Windows Server 2016)\n- Detects new and/or removed network interfaces\n- Supports multicasting on multiple network interfaces\n- Supports reverse address mapping\n- Supports service subtypes (features)\n- Handles legacy unicast queries, see #61\n\n## Getting started\n\nPublished releases are available on [NuGet](https://www.nuget.org/packages/Makaretu.Dns.Multicast/).  To install, run the following command in the [Package Manager Console](https://docs.nuget.org/docs/start-here/using-the-package-manager-console)\n\n    PM\u003e Install-Package Makaretu.Dns.Multicast\n    \nor using .NET CLI run the following command in the project folder\n\n    \u003e dotnet add package Makaretu.Dns.Multicast\n    \n## Usage Service Discovery\n\n### Advertising\n\nAlways broadcast the service (\"foo\") running on local host with port 1024.\n\n```csharp\nusing Makaretu.Dns;\n\nvar service = new ServiceProfile(\"x\", \"_foo._tcp\", 1024);\nvar sd = new ServiceDiscovery();\nsd.Advertise(service);\n```\n\nSee the [example advertiser](Spike/Program.cs) for a working program.\n\n### Discovery\n\nFind all services running on the local link.\n\n```csharp\nusing Makaretu.Dns;\n\nvar sd = new ServiceDiscovery();\nsd.ServiceDiscovered += (s, serviceName) =\u003e { // Do something };\n```\n\nFind all service instances running on the local link.\n\n```csharp\nusing Makaretu.Dns;\n\nvar sd = new ServiceDiscovery();\nsd.ServiceInstanceDiscovered += (s, e) =\u003e { // Do something };\n```\n\nSee the [example browser](Browser/Program.cs) for a working program.\n\n## Usage Multicast\n\n### Event Based Queries\n\nGet all the Apple TVs. The query is sent when a network interface is discovered. \nThe `AnsweredReceived` callback contains any answer that is seen, not just the answer\nto the specific query.\n\n```csharp\nusing Makaretu.Dns;\n\nvar mdns = new MulticastService();\nmdns.NetworkInterfaceDiscovered += (s, e) =\u003e mdns.SendQuery(\"appletv.local\");\nmdns.AnswerReceived += (s, e) =\u003e { // do something with e.Message };\nmdns.Start();\n```\n\n### Async Queries\n\nGet the first answer to Apple TVs. Wait 2 seconds for an answer.\n\n```csharp\nusing Makaretu.Dns;\n\nvar service = \"appletv.local\";\nvar query = new Message();\nquery.Questions.Add(new Question { Name = service, Type = DnsType.ANY });\nvar cancellation = new CancellationTokenSource(2000);\n\nusing (var mdns = new MulticastService())\n{\n    mdns.Start();\n    var response = await mdns.ResolveAsync(query, cancellation.Token);\n    // Do something\n}\n```\n\n### Broadcasting\n\nRespond to a query for the service.  Note that `ServiceDiscovery.Advertise` is much easier.\n\n```csharp\nusing Makaretu.Dns;\n\nvar service = \"...\";\nvar mdns = new MulticastService();\nmdns.QueryReceived += (s, e) =\u003e\n{\n    var msg = e.Message;\n    if (msg.Questions.Any(q =\u003e q.Name == service))\n    {\n        var res = msg.CreateResponse();\n        var addresses = MulticastService.GetIPAddresses()\n            .Where(ip =\u003e ip.AddressFamily == AddressFamily.InterNetwork);\n        foreach (var address in addresses)\n        {\n            res.Answers.Add(new ARecord\n            {\n                Name = service,\n                Address = address\n            });\n        }\n        mdns.SendAnswer(res);\n    }\n};\nmdns.Start();\n```\n\n## Related projects\n\n- [net-dns](https://github.com/richardschneider/net-dns) - DNS data model and Name Server with serializer for the wire and master file format\n- [net-udns](https://github.com/richardschneider/net-udns) - client for unicast DNS, DNS over HTTPS (DOH) and DNS over TLS (DOT)\n\n## License\nCopyright © 2018-2019 Richard Schneider (makaretu@gmail.com)\n\nThe package is licensed under the [MIT](http://www.opensource.org/licenses/mit-license.php \"Read more about the MIT license form\") license. Refer to the [LICENSE](https://github.com/richardschneider/net-mdns/blob/master/LICENSE) file for more information.\n\n\u003ca href=\"https://www.buymeacoffee.com/kmXOxKJ4E\" target=\"_blank\"\u003e\u003cimg src=\"https://www.buymeacoffee.com/assets/img/custom_images/yellow_img.png\" alt=\"Buy Me A Coffee\" style=\"height: auto !important;width: auto !important;\" \u003e\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frichardschneider%2Fnet-mdns","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frichardschneider%2Fnet-mdns","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frichardschneider%2Fnet-mdns/lists"}