Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS cannot discover a host running on Windows #83

Open
gomaze1031 opened this issue Feb 7, 2024 · 12 comments
Open

iOS cannot discover a host running on Windows #83

gomaze1031 opened this issue Feb 7, 2024 · 12 comments
Assignees
Labels
bug Something isn't working

Comments

@gomaze1031
Copy link

gomaze1031 commented Feb 7, 2024

Describe the bug
iOS cannot discover a host running on Windows.

I tested as follows:

  1. Connect all devices to the same WiFi (and checked they are assigned to 192.168.0.x)
  2. Start hosting on Windows and macOS
  3. iOS discovers a host running on macOS
  4. iOS cannot discover a host running on Windows
  5. Android discovers a host running on macOS and Windows

Version info:

  • Bonsoir 5.1.8
  • Windows 10 22H2(19045.3930)
  • macOS 14.2.1
  • iOS 17.2.1
  • Android 14

FYI, there is no errors or other logs printed. Not sure it is a bug.
Thanks for your nice work!

@gomaze1031 gomaze1031 added the bug Something isn't working label Feb 7, 2024
@Skyost
Copy link
Owner

Skyost commented Feb 7, 2024

Are you sure you're discovering the correct type ? Do you have a snippet or something ?

@gomaze1031
Copy link
Author

I think I discovered the correct type.
Here are some snippets.

startDiscovery()

_dnsHost = BonsoirBroadcast(
  service: BonsoirService(
    name: "my_bonsoir_server",
    type: "_dns-service._tcp",
    port: 56000,
  ),
);

await _dnsHost?.ready;
await _dnsHost?.start();

startScan()

BonsoirDiscovery discovery = BonsoirDiscovery(type: "_dns-service._tcp");
_mDnsDiscovery.discovery = discovery;
await discovery.ready;

discovery.eventStream!.listen((event) async {
  if (event.type == BonsoirDiscoveryEventType.discoveryServiceFound) {
    debugPrint('Service found : ${event.service?.toJson()}');

    if (event.service is ResolvedBonsoirService) {
      ...
      return;
    }

    // Should be called when the user wants to connect to this service.
    await event.service!.resolve(discovery.serviceResolver);
  } else if (event.type == BonsoirDiscoveryEventType.discoveryServiceResolved) {
    debugPrint('Service resolved : ${event.service?.toJson()}');
    ...
  } else if (event.type == BonsoirDiscoveryEventType.discoveryServiceLost) {
    debugPrint('Service lost : ${event.service?.toJson()}');
    ...
  }
});

await discovery.start();

Not sure it helps you but this is all I've got.

  • Side question: when the event.type is "discoveryServiceFound", event.service can be "ResolvedBonsoirService"?

@Skyost
Copy link
Owner

Skyost commented Feb 14, 2024

Side question: when the event.type is "discoveryServiceFound", event.service can be "ResolvedBonsoirService"?

Nop !

@jaween
Copy link

jaween commented Mar 8, 2024

I am running into this same issue:

  • Windows, Mac and Linux apps are using Bonsoir to broadcast, Android and iPhone apps are using Bonsoir to discover
  • All devices are on the same Wi-Fi network running the same version of Bonsoir
  • Android sees all three broadcasts, iPhone sees two, missing Windows
  • No Windows discovery events show up on the iPhone
  • Both phones successfully resolve the hosts they see

Versions:

  • Bonsoir 5.1.8
  • Windows 11 Pro 23H2 (22631.3155)
  • macOS 14.3.1
  • Linux Ubuntu 22.04.3 LTS (Avahi Daemon 0.8)
  • iOS 15.7.9
  • Android 13

@Skyost
Copy link
Owner

Skyost commented Mar 10, 2024

Hey,

This could be the same problem than https://stackoverflow.com/questions/60925721/my-ios-macos-devices-are-unable-to-resolve-my-bonjour-zeroconf-service-created-o. Does it work with a ResolvedBonsoirService ?

@jaween
Copy link

jaween commented Mar 10, 2024

(Sorry maybe I'm misunderstanding)

With the link it looks like they used an npm package to broadcast a bonjour service which iOS discovered sucessfully, but couldn't resolve it without an extra parameter in the broadcast. But in our case iOS is not even discovering the service.

ResolvedBonsoirService works with the discovered Mac and Linux services, and I assume if the Windows service was discovered, it would work too.

@Skyost
Copy link
Owner

Skyost commented Mar 11, 2024

You're right, I've misread the SO post. I'll continue to investigate on my side, but feel free to post here if you got something new.

@lexxxel
Copy link

lexxxel commented Sep 19, 2024

Have the same issue, but discovered something strange. When I use an iPhone App as bounjour browser, I can't see the windows host. However, when I start a Linux server on parallel, both server become visible.
To me, this looks like something is broken with the service topic (or whatever it's called).

Edit: when I shutdown the Linux server, the windows entry is gone, too.

@lexxxel
Copy link

lexxxel commented Sep 19, 2024

Another finding. Windows does not publish its IP address under host, but its link local URL.

@lexxxel
Copy link

lexxxel commented Sep 22, 2024

Found a fix, fill the attributes:

BonsoirService service = BonsoirService(
      name: name,
      type: type,
      port: port,
      attributes: {"DUMMY": "iOSFix"}, // <- content does not matter, but you have to set a TXT info.
    );

This is so stupid, I didn't believe it first.

@Skyost
Copy link
Owner

Skyost commented Sep 30, 2024

@lexxxel Good find ! To summarize, you @lexxxel say we need to publish a TXT record so that Windows hosts can be discovered by Darwin devices ?

@lexxxel
Copy link

lexxxel commented Sep 30, 2024

Yes, at least on iOS device using this lib for discovery. When I use avahi browser UI under Linux or an equivalent on macOS, I do NOT see the service. But the service is always discovered by the avahi browser cli tool under Linux (with and without a TXT) or on iOS (only with a TXT) and Android (with and without a TXT) when using the lib.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants