Skyost / Bonsoir

A Zeroconf library that allows you to discover network services and to broadcast your own. Based on Apple Bonjour and Android NSD.
http://bonsoir.skyost.eu/
Other
100 stars 43 forks source link

Getting the IP/address of BonsoirDiscoveryEvent #75

Closed guyluz11 closed 6 months ago

guyluz11 commented 6 months ago

Is your feature request related to a problem? Please describe. I would like to get the IP address from or in the BonsoirDiscoveryEvent to show the user that information for this device.

Describe the solution you'd like BonsoirDiscoveryEvent to include an address field of IPV4 and IPV6 or a method to get that info from the BonsoirDiscoveryEvent

Describe alternatives you've considered I saw the option in another mDNS package so maybe using that https://pub.dev/packages/nsd#get-ip-addresses-for-service. Also there is might be a way to get it using ping to the hostname but this is another step and I think should be part of the package.

Additional context

Skyost commented 6 months ago

Use service.resolve(discovery.serviceResolver) to get its IP address. It's written in the docs.

guyluz11 commented 6 months ago

It returns Fututre void.

And I have searched in the doc for the keyword address and IP, maybe we should include them in its description.

Skyost commented 6 months ago

It returns Future<void> because it's the call result. The IP is then returned when discoveryServiceResolved is triggered. See https://bonsoir.skyost.eu/docs#discover-services.