Comments (15)
I tried a further test: I added my phone to the network where I can discover the printer but not the published service...
I also tried to turn off my firewalls as well my anti-virus app without any success...
from net-mdns.
@a13u Sorry that things are not working out. Can you tell me what OS your are using?
from net-mdns.
no problem ;)
I just want to find out what is happening....
I am using Windows 10
from net-mdns.
In my Windows Printers and Device-Manager I can see the printer - I guess it discovers it with noconfnetwork
from net-mdns.
I've tidied up your code, so that console output is readable. Also, see the spike that I wrote to test things out.
public static void Main(string[] args)
{
var service = new ServiceProfile("x", "_sdtest-2._tcp", 1024);
var mdns = new MulticastService();
var sd = new ServiceDiscovery(mdns);
mdns.NetworkInterfaceDiscovered += (s, e) =>
{
foreach (var nic in e.NetworkInterfaces)
{
Console.WriteLine($"discovered NIC '{nic.Name}'");
}
sd.QueryAllServices();
};
sd.ServiceDiscovered += (s, serviceName) =>
{
Console.WriteLine("found " + serviceName);
};
try
{
sd.Advertise(service);
mdns.Start();
Console.ReadKey();
}
finally
{
sd.Dispose();
mdns.Stop();
}
}
from net-mdns.
Can you show me the output from the above code or from running the spike.
from net-mdns.
I get nothing....
The spike project returns the following
Multicast DNS spike
IP address fe80::a4bf:df55:XXXXX
IP address 10.0.0.9
21.07.2018 16:45:25 [DEBUG] Makaretu.Dns.MulticastService - Found nic 'WLAN'.
discovered NIC 'WLAN'
got a query for _homekit._tcp.local PTR, _sleep-proxy._udp.local PTR
21.07.2018 16:46:09 [DEBUG] Makaretu.Dns.ServiceDiscovery - got query for _homekit._tcp.local PTR
got a query for _homekit._tcp.local PTR, _sleep-proxy._udp.local PTR
21.07.2018 16:46:10 [DEBUG] Makaretu.Dns.ServiceDiscovery - got query for _homekit._tcp.local PTR
got a query for _homekit._tcp.local PTR, _sleep-proxy._udp.local PTR
21.07.2018 16:46:13 [DEBUG] Makaretu.Dns.ServiceDiscovery - got query for _homekit._tcp.local PTR
got a query for _homekit._tcp.local PTR, _sleep-proxy._udp.local PTR
21.07.2018 16:46:22 [DEBUG] Makaretu.Dns.ServiceDiscovery - got query for _homekit._tcp.local PTR
got a query for _http._tcp.local PTR
21.07.2018 16:46:23 [DEBUG] Makaretu.Dns.ServiceDiscovery - got query for _http._tcp.local PTR
got a query for _http._tcp.local PTR
21.07.2018 16:46:24 [DEBUG] Makaretu.Dns.ServiceDiscovery - got query for _http._tcp.local PTR
got a query for _http._tcp.local PTR
21.07.2018 16:46:27 [DEBUG] Makaretu.Dns.ServiceDiscovery - got query for _http._tcp.local PTR
from net-mdns.
Please note that the above is only discovering services available on the local network NOT the devices.
Make this change to ask for all devices (service instances) of a service
sd.ServiceDiscovered += (s, serviceName) =>
{
Console.WriteLine("found " + serviceName);
mdns.SendQuery(serviceName, type: DnsType.PTR);
};
from net-mdns.
I have not yet written a generic ServiceInstanceDiscovery (device discovery) method yet. The above code will ask for all devices with the services names and you can see the answer in the debug logs.
However to process the information you need to drop down to mdns.AnswerReceived
from net-mdns.
I'll add some device discovery into the spike. However its 03:00 my time and I'm goinf to bed. Talk to later and BTW thanks for the interest in the project.
from net-mdns.
I added sd.QueryAllServices(); to "mdns.NetworkInterfaceDiscovered += (s, e) =>.." in Spike
Now I find at least my local services ;)
from net-mdns.
Thank you for your support
from net-mdns.
I found out that my discovery app on my mobile phone was just looking for services on port 80....
Further, I guess that my printer is not working correctly...
For me, it seems like that "QueryAllServices()" has to be called continously in order to avoid missing a new service?
I am not sure, if this is the intended space for discussions - please, correct me if not:
After a service is discovered, the following code is called:
sd.ServiceDiscovered += (s, serviceName) =>
{
Console.WriteLine("found " + serviceName);
mdns.SendQuery(serviceName, type: DnsType.PTR);
};
How can I find the host of this service? s is of type Makaretu.Dns.ServiceDiscovery --> I do not no know how to get a [DNS-Name/IP]->Service-Name Mapping
If I ping my Host-name I do not get a repsons --> I only see that a request is received - has this to be implemented by the user of the library?
Thank you for your awesome implementation and effort!
from net-mdns.
QueryAllServices
does not need to be called continuously because new services will advertise themselves.
To get the service instance host name. You need to send a query for its SRV record then query for A/AAAA records.
from net-mdns.
An example browser is now at https://github.com/richardschneider/net-mdns/blob/master/Browser/Program.cs
Hope it helps.
from net-mdns.
Related Issues (20)
- Cannot get the device IP address
- Make exclusion of Loopback interface configurable.
- Internal InvalidOperationException occurs HOT 2
- Not getting any response for ResolveAsync HOT 7
- No query received after enabling a networkinterface HOT 1
- ServiceDiscovery not working on WiFi connection HOT 3
- Responses to MultiCast TXT queries not received HOT 1
- Advertised service not showing in network
- Breaking change in IPNetwork2 2.6.459 leads to exception in mdns HOT 1
- No commits from Richard Schneider HOT 1
- Register custom record types HOT 1
- ServiceDiscovery doesn't advertise ServiceProfile's port HOT 2
- I got this unhandled exception when I have attached the TaskScheduler.UnobservedTaskException: HOT 4
- Stack Overflow in network discovery on OS X HOT 4
- Responses to unicast queries not received HOT 11
- Not all members in Multicastclient are disposed HOT 10
- Getting network interface in AnswerReceived
- Timeout of 2 minutes on mdns resolution HOT 1
- How to detect a device is offline? HOT 3
- Memory leak in MulticastService HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from net-mdns.