Bonsoir icon indicating copy to clipboard operation
Bonsoir copied to clipboard

Windows support

Open rope50 opened this issue 3 years ago β€’ 6 comments

Is your feature request related to a problem? Please describe. No.

Describe the solution you'd like Be able to use this package in my flutter desktop windows app

Describe alternatives you've considered ... Additional context I'll be very grateful if you add windows support for this package.

Thanks!!!

rope50 avatar Jun 24 '21 22:06 rope50

Yeah! That would be cool to use that package on desktop.

breitburg avatar Jun 26 '21 04:06 breitburg

I agree, but I think I will need some help for this one πŸ˜„

Skyost avatar Jul 03 '21 08:07 Skyost

win32

https://docs.microsoft.com/en-us/windows/win32/api/windns/nf-windns-dnsservicebrowse https://docs.microsoft.com/en-us/windows/win32/api/windns/nf-windns-dnsserviceregister

uwp

https://docs.microsoft.com/en-us/uwp/api/windows.networking.servicediscovery.dnssd

FYI, Here are documents of Windows API.

kyle-seongwoo-jun avatar Aug 09 '21 01:08 kyle-seongwoo-jun

This would be nice. In the interim, I've forked and patched version of the Flutter standard mdns library that is usable on Windows desktop:

https://github.com/0xnf/flutter_multicast_dns

I run bonsoir for mobile, and the multicast_dns for Mac and Windows desktops. It's working fine for now, but I'd course like to unify to one well-maintained library in the future.

0xNF avatar Oct 28 '21 09:10 0xNF

I agree, but I think I will need some help for this one πŸ˜„

Is there any plan to support windows? πŸ˜„

zzdota avatar Nov 17 '21 02:11 zzdota

@zzdota

Is there any plan to support windows? πŸ˜„

Not from my side, but you're free to do work on it πŸ‘

Skyost avatar Nov 26 '21 18:11 Skyost

Hi.

I am the author of a Linux platform interface and I was wondering if you guys were interested in Windows support, and if so: which ones would they be.

  • Windows support by linking directly to the dns_sd.h library (requires having at least Bonjour Print Services installed on client's computers, but works on older versions of Windows).
  • Windows 10 support by wrapping mDNS APIs in windows platform directly. (only windows 10 support, no external requirements needed)
  • Best effort support by beating multicast_dns into an embedded multicast dns responder/resolver (works on any dart version, but it might conflict with an existing mDNSResponder)

Right now, as an experiment, I've wrapped dns_sd.h into an async wrapper for Dart and it would be not hard to add flutter support now that the package is federated.

Piero512 avatar Sep 21 '22 12:09 Piero512

I think it would be best to go with option 2, considering that Windows 10 and 11 currently hold a combined ~85% market share, and while flutter technically still supports 7 and 8, they are already considered EOL by Microsoft and many software vendors are increasingly cutting support for <10.

Plus, having no external requirements is a big plus from an UX standpoint (assuming you are developing an application intended for distribution)

TheBITLINK avatar Feb 15 '23 13:02 TheBITLINK

Just a quick notice: I needed basic windows support for my application and implemented option 1(using dns_sd.h) myself a few days ago. As @TheBITLINK says, option 2 would be the better option but I did not get it to work straight away so I fell back to dns_sd.h.

As of now my implementation is a proof of concept with some known bugs, you can check it out here.

Bennik2000 avatar Feb 23 '23 12:02 Bennik2000

I'll follow your PR @Bennik2000 πŸ‘

Skyost avatar Feb 28 '23 10:02 Skyost

@Bennik2000 : I tried the current state of your implementation in a project of mine - works very nicely, but has one bug:

Bonjour SDK requires/provides ports as uint16_t, but with the bytes swapped. Otherwise the results come out wrong: I scanned for a service on port 3000 (0x0BB8) and got 47115 (0xB80B) as a result - can't connect to the service on that port...

You'll need to swap the bytes of the port in bonsoir_discovery.cpp --> DNSServiceResolveCallback (swap the bytes of the port parameter before you store it in service.port), also in bonsoir_broadcast.cpp --> startBroadcast (swap bytes of service.port before you use it as parameter of DNSServiceRegister() )

Guess you'll want to fix that in your pull request...

Don't want to mess up your repository (not sure what happens if I create a PR on your PR???), so better if you fix that directly in your PR than me getting in the way - OK?

ToH2002 avatar Jul 17 '23 21:07 ToH2002

another interesting 🀯experience: using the Bonjour SDK will not work with newer versions of the Bonjour service. I had Bonjour 3.1.0.1 installed on one of my PCs - running my Flutter app on that one kept crashing my app during Bonjour discovery. Uninstalling 3.1.0.1 and installing 3.0.0.1 (came with the SDK) made everything nice and good again. Looks like there are some breaking changes in newer versions of Bonjour vs. the SDK.

I'm not enough of an expert to get deeper into this - for the moment, I've got things limping along, but maybe the better path would actually be to use native windows functions (option 2)...

ToH2002 avatar Jul 17 '23 23:07 ToH2002