Comments (13)
I haven't looked into this very deeply but my guess is, they'd have to use the method described above:
- Do discovery using special service type
_services._dns-sd._udp
- Receive list of all service types in network
- Do discovery for each service type
That would give you a complete list of all service types and services in the network.
from nsd.
To my understanding, there's no wildcard in the DNS-SD specification.
On the plus side, chapter 9 about service type enumeration states that if you use the special type _services._dns-sd._udp
, you should get an enumeration of service types. You could then start a query for each service type received, and get all the devices on your network.
Right now the plugin doesn't support this special type (the string doesn't pass the validation regex) but I will have a look at this because it could definitely be useful.
from nsd.
As I wrote on osociety/vernet#6 if there is an option to search for all services that start with TCP or search a list of known services this could also be a good start.
from nsd.
search for all services that start with TCP or search a list of known services
I believe that both of these options are not supported by the DNS-SD specification. Consequently, the platform APIs (NsdManager on Android, NetService on iOS / macOS) do not support this. Do correct me if I'm wrong.
from nsd.
Not that I know of.
But now I am curious how avahi-browse --all
and mdns-scan
do that on Linux.
And how does other apps on android do that like Network Scanner
from nsd.
I've implemented the above approach and it passes the integration test on Android / macOS / iOS. So in the new version (1.2.0) you can start a discovery like this:
final discovery = await startDiscovery('_services._dns-sd._udp', autoResolve: false);
The autoResolve
flag is important because the results are not real services and cannot be resolved. The discovery.services
list will then be populated with the answers. The answers look like this:
[MethodChannelNsdPlatform] [2022-01-21 12:19:56.941821] [calls] Callback: onServiceDiscovered {service.type: _tcp.local, service.host: null, service.name: _foo, handle: a353ff28-40dd-425d-a5a0-9966eea0c708}
[MethodChannelNsdPlatform] [2022-01-21 12:19:56.944118] [calls] Callback: onServiceDiscovered {service.type: _tcp.local, service.host: null, service.name: _bar, handle: a353ff28-40dd-425d-a5a0-9966eea0c708}
The first component of the service type (e.g. _foo
) is contained in the service name attribute, the second component of the service type (e.g. _tcp
) is contained in the service type attribute.
Even though using a service structure to represent a service type feels like a hack, it seems to be consistent on Android / macOS / iOS platform APIs. Since they are both doing it, I chose to adapt the same behavior for the plugin.
from nsd.
Testing it now looks good.
have a couple of questions
- Host and Port are unknown. Is it a bug? is it a work in progress?.
- Using the default service
_googlecast._tcp
the discover finds my MiBox, but I can't see it when using the new discover all that you just implemented. Have I found a bug?.
Not sure if this is related, MIBOX show as Type_googlecast._tcp
and using the new method the devices are shown as_tcp.local
. - I think it will be good to change the default search in the example to search for all services
Line 37 in 46d1fd0
from nsd.
- A discovery of
_services._dns-sd._udp
does not find services, it finds service types. They don't have ports or hosts. - The new feature is not a discover all. It finds service types. It should find the service type
_googlecast._tcp
in your case. You can then use the service type to find all services of the type. - Good idea about updating the example, will put this on my backlog.
from nsd.
You can enable call logging using
enableLogging(LogTopic.calls);
If you post the log here, I'll have a look at it.
from nsd.
it finds service types.
Totally forgot about that, yes it finds _googlecast.tcp.local
nice.
Thanks for solving that, can I get the device IP from the result by pinging by name or hostname?
from nsd.
IPs are not part of the plugin right now (see #7). So yes, for now you'd have to lookup the host name received using something like InternetAddress.lookup.
from nsd.
Ok thanks, will try InternetAddress.lookup
for IP.
from nsd.
_services._dns-sd._udp
Hello, i'm trying to find service type by using '_services._dns-sd._udp' but i got Callback: onDiscoveryStartFailed {handle: 06ac4af5-1301-4b78-9460-6dc6c16078d0}. I added info.plist
<key>NSBonjourServices</key>
<array>
<string>_http._tcp</string>
<string>_services._dns-sd._udp</string>
<string>_googlecast._tcp</string>
</array>
Can you please help me? @sebastianhaberey
from nsd.
Related Issues (20)
- mDNS Service registered with nsd not resolving correctly. HOT 2
- Select on which network interface to search HOT 1
- Windows: when the device name contains Chinese, the client cannot find the service.
- Flutter windows app crashes randomly on start HOT 8
- NsdError (message: "missing required configuration HOT 11
- stopDiscovery Not working giving below exception HOT 3
- nsd 2.3.1 Not compatible uuid 4.1.0 HOT 1
- (warning) 'com.haberey/nsd' channel message on a non-platform thread HOT 1
- `stopDiscovery` should `dispose()` the `Discovery` HOT 3
- Android: failure on unregistration does not report back to dart side HOT 1
- [Question] Unregistering service when app crushes or when a user terminated app in force. HOT 2
- Works on iOS sim but not on actual device HOT 1
- Include permissions as part of the dependency HOT 1
- Add Linux support HOT 1
- pub.dev Changelog tab is reversed
- Get all serviceTypes does not work
- Error running inside isolate
- Discovery not working on macOS
- '_services._dns-sd._udp' not working on real IOS device. HOT 3
- On Android, the IP address and not the hostname is returned in the host field of a Service after a discovery
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 nsd.