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

How to get the IP of the resolved service? #96

Closed jonnybrooks closed 4 days ago

jonnybrooks commented 1 month ago

Hi there! First of all thanks for making this package, it works super great OOTB.

The only trouble I'm having is how to get the IP of the published service after resolving it... doing a code search, I see that service.ip was updated to service.host, but when I print out service.host it isn't an IP address but the host name like "Android.local."

Any help would be much appreciated!

Skyost commented 4 weeks ago

Hey,

Why do you want to resolve a service host ? Most of the time you only need an host 🙂

jonnybrooks commented 3 weeks ago

Hey @Skyost, thanks for the reply! How is it possible to query the service without an IP? Sorry for the n00b question, but I thought the host name was just "superficial" - so it's possible to make an http request like: http://Android.local:3000/ or something?

Skyost commented 5 days ago

Sorry for the delay, I was super busy until last week. Yep, you can totally make your requests to homeassistant.local instead of 192.168.1.100 🙂

jonnybrooks commented 4 days ago

That's so cool! Thank you very much. Can't wait to try this out :D