I am using RawDatagramSocket to send multicast on 239.255.255.250 with port 3702 And it return SocketException: Send failed (OS Error: No route to host, errno = 65), address = 0.0.0.0, port = 2000 The problem is only with iOS physical Phone, iOS simulator and Android are fine My iPhone verions is iPhone SE and iOS version is 16.1.1
here's my code
try {
List<int> dataToSend = codec.encode('some string here')
udpSocket?.close();
udpSocket = await RawDatagramSocket.bind(
InternetAddress.anyIPv4,
2000,
);
if (udpSocket != null) {
udpSocket!.listen(
(RawSocketEvent event) async {
if (event == RawSocketEvent.read) {
Datagram dg = udpSocket!.receive()!;
String data = utf8.decode(dg.data);
print(data);
}
},
);
udpSocket!.send(
dataToSend,
InternetAddress('239.255.255.250'),
3702,
);
}
} catch (e) {
print(e);
}
And I also enabled Multicast Networking entitlement enter image description here
And here's my Info.plist
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>NSBonjourServices</key>
<array>
<string>_http._tcp.</string>
</array>
<key>NSLocalNetworkUsageDescription</key>
<string>Viper Cam will use this permission to discover the camera</string>
<key>UIBackgroundModes</key>
<array>
<string>fetch</string>
<string>remote-notification</string>
</array>
Flutter --version
Flutter 3.13.1 • channel stable • https://github.com/flutter/flutter.git
Framework • revision e1e47221e8 (3 months ago) • 2023-08-22 21:43:18 -0700
Engine • revision b20183e040
Tools • Dart 3.1.0 • DevTools 2.25.0