Closed briankendall closed 1 year ago
You mentioned you have not tested this on Android. What other OSs have you tested?
I compiled it on macOS, so the Bonjour code path at least compiles, and does indeed work on macOS.
Linux / avahiClient.cpp was missing so I added and tested on Linux. If I remember correctly I had issues with browsing by interface when I started this project, so that may be why I left by interface out for publishing as well.
This adds an optional parameter to
registerService
that allows specifying a specific interface index to bind to. I added it since I needed to publish a service specifically on the loopback interface. Since the parameter is optional, it shouldn't break any existing code.This seems to duplicate the work of #25 but that PR was never merged. I think that PR also had an error where it would pass the wrong argument to
avahi_server_add_service_strlst
when using the previous / default behavior ofregisterService
. (It ought to passAVAHI_IF_UNSPEC
for the interface index, which has a value of-1
not0
.)Full disclosure: I have not tested the Android specific code as I don't have a dev environment for that. The change is quite small though and I'm pretty sure I got it right. But it should be verified.