[multicast_dns] iOS Broken after upgrade to iOS 16.0

This issue has been created since 2022-09-22.

On a Linux board an avahi service is broadcasting:

[email protected]:/etc/avahi/services$ cat test.service 
<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">

<service-group>

  <name replace-wildcards="yes">test</name>

  <service>
    <type>_http._tcp</type>
    <port>80</port>
  </service>

</service-group>

Here is my test application based on the muticast_dns example:

import 'package:flutter/material.dart';
import 'package:multicast_dns/multicast_dns.dart';

void main() {
  runApp(TestApp());
}

class TestApp extends StatelessWidget {
  Future<void> test() async {
    const String name = '_http._tcp.local';
    final MDnsClient client = MDnsClient();
    // Start the client with default options.
    await client.start();

    // Get the PTR record for the service.
    await for (final PtrResourceRecord ptr in client
        .lookup<PtrResourceRecord>(ResourceRecordQuery.serverPointer(name))) {
      // Use the domainName from the PTR record to get the SRV record,
      // which will have the port and local hostname.
      // Note that duplicate messages may come through, especially if any
      // other mDNS queries are running elsewhere on the machine.
      await for (final SrvResourceRecord srv
          in client.lookup<SrvResourceRecord>(
              ResourceRecordQuery.service(ptr.domainName))) {
        // Domain name will be something like "[email protected]_dartobservatory._tcp.local"
        final String bundleId =
            ptr.domainName; //.substring(0, ptr.domainName.indexOf('@'));
        print('Dart observatory instance found at '
            '${srv.target}:${srv.port} for "$bundleId".');
      }
    }
    client.stop();

    print('Done.');
  }

  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Test'),
        ),
        body: Container(),
        floatingActionButton: FloatingActionButton(
          onPressed: test,
          child: const Icon(Icons.add),
        ),
      ),
    );
  }
}

This is what I get from Android exactly as expected.
I/flutter (19901): Dart observatory instance found at 220920.local:80 for "test._http._tcp.local".

It was working on iOS before I made an upgrade to iOS 16.0. and this is the output from the same app now:

[VERBOSE-2:dart_vm_initializer.cc(41)] Unhandled Exception: SocketException: Send failed (OS Error: No route to host, errno = 65), address = 0.0.0.0, port = 5353
#0      _NativeSocket.send (dart:io-patch/socket_patch.dart:1213:34)
#1      _RawDatagramSocket.send (dart:io-patch/socket_patch.dart:2460:15)
#2      MDnsClient.lookup (package:multicast_dns/multicast_dns.dart:225:14)
#3      TestApp.test (package:mdnssd/main.dart:17:10)
<asynchronous suspension>
flutter: Done.

I am using: multicast_dns: ^0.3.2+2

flutter doctor -v
[✓] Flutter (Channel stable, 3.3.2, on macOS 12.6 21G115 darwin-x64, locale en-DE)
    • Flutter version 3.3.2 on channel stable at /Users/nikolay/development/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision e3c29ec00c (8 days ago), 2022-09-14 08:46:55 -0500
    • Engine revision a4ff2c53d8
    • Dart version 2.18.1
    • DevTools version 2.15.0

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Users/nikolay/Library/Android/sdk
    • Platform android-32, build-tools 30.0.3
    • ANDROID_HOME = /Users/nikolay/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.0)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14A309
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2020.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)

[✓] IntelliJ IDEA Community Edition (version 2019.3.3)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin version 45.1.2
    • Dart plugin version 193.7547

[✓] VS Code (version 1.71.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.48.0

[✓] Connected device (4 available)
    • SM J730F (mobile)        • 192.168.0.52:5555         • android-arm    • Android 9 (API 28)
    • Koleto’s iPhone (mobile) • 00008030-000E30123E04802E • ios            • iOS 16.0 20A362
    • macOS (desktop)          • macos                     • darwin-x64     • macOS 12.6 21G115 darwin-x64
    • Chrome (web)             • chrome                    • web-javascript • Google Chrome 105.0.5195.125

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!
huycozy wrote this answer on 2022-09-23

Hi @koleto, thanks for filing the issue.
Does this issue happen on lower iOS versions or lower multicast_dns plugin versions?

koleto wrote this answer on 2022-09-23

Hi @huycozy! On my dev, iPhone 6 (iOS 15.6.1) is working without problems. The same code on another one iPhone 11 (iOS 16.0) cause the problem, and Android is OK. Since it was working with the last one, I didn't check the lower multicast_dns version. I will let you know about lowering the plugin version tests.

koleto wrote this answer on 2022-09-23

@huycozy I have been testing 0.3.2+1, 0.3.2, 0.3.1 and 0.3.0 on both iOS 15.6.1 and 16.0. The same test application, always the same results:

  • iOS 15.6.1
    flutter: Dart observatory instance found at 220920.local:80 for "test._http._tcp.local".

  • iOS 16.0

[VERBOSE-2:dart_vm_initializer.cc(41)] Unhandled Exception: SocketException: Send failed (OS Error: No route to host, errno = 65), address = 0.0.0.0, port = 5353
#0      _NativeSocket.send (dart:io-patch/socket_patch.dart:1213:34)
#1      _RawDatagramSocket.send (dart:io-patch/socket_patch.dart:2460:15)
#2      MDnsClient.lookup (package:multicast_dns/multicast_dns.dart:225:14)
#3      TestApp.test (package:mdnssd/main.dart:17:10)
<asynchronous suspension>
flutter: Done.
More Details About Repo
Owner Name flutter
Repo Name flutter
Full Name flutter/flutter
Language Dart
Created Date 2015-03-06
Updated Date 2022-10-05
Star Count 145512
Watcher Count 3569
Fork Count 23398
Issue Count 11205

YOU MAY BE INTERESTED

Issue Title Created Date Comment Count Updated Date
LNURL can now be supported by CLightningWallet without Spark 2 2022-05-17 2022-08-19
broken exclude on macos? 1 2022-05-24 2022-07-20
Updates to Correlated Error Code 2 2021-09-20 2022-10-01
Data assimilation from N20 OMPS NP and NM 2 2021-09-20 2022-09-22
Add a configurable variable to multiply the obs error for OMPS LP 1 2021-09-20 2022-08-15
[https://invoice.stripe.com/i/acct_1JQXQKlk2ucCGjAf/invst_K5k770bKQ5rQuMC](stripe.com) # 0 2021-10-19 2022-07-09
Can't unlock with pam 1.5.1 4 2021-01-10 2022-08-15
Have a failback to Testnet if Sandbox isn't supported 0 2021-09-13 2022-09-04
docker-java-core should depend on commons-compress without security vulnerabilities 2 2021-08-18 2022-09-25
evaluate expectation value of general hermitian operator in Yao 1 2022-04-23 2022-10-05
WMS CreateTileSource schema 2 2022-03-24 2022-09-20
Add dataAcquisition type to EVERY adapter 2 2019-10-08 2022-10-04
support for "suppress <lint rule>" textDocument/codeAction action 4 2021-03-29 2022-10-05
ItemsAdder Causes head-based machine texture's getting bugged 2 2022-06-11 2022-09-14
rest.ino: "EL-Client sync failed!" 2 2020-11-29 2022-08-18
bug: internal props are required when using svelte bindings with typescript 0 2021-01-12 2022-09-22
change grouping and add version drop down 2 2019-06-25 2022-09-28
RCS flight planning has incorrect burn times 0 2022-08-16 2022-09-19
file appender fails with EEXIST 7 2022-02-18 2022-09-13
How to parse BigInt using Response.json() function ? 1 2022-07-29 2022-09-19
Feature detecting streaming requests 5 2022-07-12 2022-09-19
Applied width of the scanner is "0" 5 2021-12-09 2022-09-24
Updating nuget metadata 0 2020-12-30 2022-09-27
Movie Failed To Add (others add fine) 4 2022-06-10 2022-09-10
Bump kohttp version to work with latest Android 6 2020-10-31 2022-08-24
Support for OpenAPI3 14 2018-05-14 2022-07-17
ftp.pcre.org has been TAKEN DOWN 7 2021-11-15 2022-09-30
Screenshots for Spotify are outdated 1 2021-10-23 2022-09-30
(in promise) MiniProgramError 还未运行游戏状态报错 4 2022-06-24 2022-09-30
c++/10/chrono:428:27: internal compiler error: Segmentation fault 4 2021-10-26 2022-10-03
Embeddable should be allowed as static inner class 0 2021-09-10 2022-09-06
error , loss ..plots an pool in update 1.2.7 3 2021-09-20 2022-09-26
[BUG]Custom Pause Print Message is overwritten 3 2021-12-14 2022-08-31
Merged MLA values.yaml similar to KKP values.yaml 0 2021-09-16 2022-05-12
Support AsyncAPI standard for Edge endpoints 0 2022-06-15 2022-10-03
TypeError: echo() got an unexpected keyword argument 'fg' 4 2022-05-09 2022-09-20
The rule breaks filtering on terra.com.br 1 2021-07-15 2022-09-25
[macOS] Game crashes after scanning completed 0 2021-01-13 2022-08-16
[4.0] Inspector shows Node2D.`rotation` in degrees, but hovering on the property says it's in radians. 1 2022-08-15 2022-08-09
Exclude whole repo/Folder when using foam in a multi-root workspace 2 2022-09-01 2022-09-26
Consider more Specific Bump Specification 2 2021-11-04 2022-08-25
Add Mixed Instance and Purchase Options support to Buildkite ASG 0 2020-10-27 2022-10-02
Email setup from the PostHog app 9 2021-09-06 2022-08-03
Remove shipping cost from cart and checkout before carrier selection 2 2022-07-12 2022-10-05
Loaded scripts view should use label service 2 2022-04-29 2022-10-03
support for `fromConnectionSecretKey` patch 11 2021-12-16 2022-07-22
Refactor `ImportDatabaseConfigurationHandler` to only allow imports when database is empty 2 2022-06-30 2022-10-03
Investigate potential extra dependencies we don't need 3 2021-10-04 2022-07-28
Documentation issue: Upgrading kubeadm clusters 3 2021-09-16 2022-09-30
[Feature] Please add arm64 build 2 2021-08-06 2022-10-05