Repository: flutter
Issue: No way to differentiate between Dart VMs per device with mDNS
Labels: platform-ios,tool,P2,team-tool,triaged-tool

### Is there an existing issue for this?

- [X] I have searched the [existing issues](https://github.com/flutter/flutter/issues)
- [X] I have read the [guide to filing a bug](https://flutter.dev/docs/resources/bug-reports)

### Steps to reproduce

1. Have 2 devices
2. Run flutter app through Xcode on Device 1
3. Run `flutter attach` in project directory, when it prompts you to select a device, pick Device 2

Note: There are other ways in which this can occur, but this is just an easy way to recreate

### Actual results

You'll eventually get an error like
```
Waiting for a connection from Flutter on iPhone SE (3rd generation)...
Connecting to the VM Service is taking longer than expected...
Still attempting to connect to the VM Service...
If you do NOT see the Flutter application running, it might have crashed. The device logs (e.g. from adb or XCode)
might have more details.
If you do see the Flutter application running on the device, try re-running with --host-vmservice-port to use a
specific port known to be available.
Exception attempting to connect to the VM Service: SocketException: Connection refused (OS Error: Connection refused,
errno = 61), address = 127.0.0.1, port = 58122
```

Behind the scenes, it's using mDNS to find the Dart VM. It finds the Dart VM from device 1 and tries to connect to it using Device 2, which obviously doesn't work.

We should differentiate Dart VMs per device.

### Logs

<details>
<summary>Logs</summary>

```console

<!-- Paste your logs here -->

```

</details>


### Flutter Doctor output

<details>
<summary>Doctor output</summary>

```console

[!] Flutter (Channel [user-branch], 3.13.0-3.0.pre.32, on macOS 13.4.1 22F82 darwin-arm64, locale en)
    ! Flutter version 3.13.0-3.0.pre.32 on channel [user-branch] at xxx
      Currently on an unknown channel. Run `flutter channel` to switch to an official channel.
      If that doesn't fix the issue, reinstall Flutter by following instructions at
      https://flutter.dev/docs/get-started/install.
    ! Upstream repository unknown source is not a standard remote.
      Set environment variable "FLUTTER_GIT_URL" to unknown source to dismiss this error.
    • Framework revision 8e80663640 (27 hours ago), 2023-07-13 10:50:24 -0700
    • Engine revision 88b8581516
    • Dart version 3.1.0 (build 3.1.0-307.0.dev)
    • DevTools version 2.25.0
    • If those were intentional, you can disregard the above warnings; however it is recommended to use "git"
      directly to perform update checks and upgrades.

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at xxx
    • Platform android-33, build-tools 33.0.0
    • ANDROID_SDK_ROOT = xxx
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.0)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15A5195m
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.1)
    • 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.15+0-b2043.56-8887301)

[✓] VS Code (version 1.80.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.68.0

[✓] Connected device (4 available)

[✓] Network resources
    • All expected network resources are available.

```

</details>