iOS 14 gives "OS Error: Bad file descriptor, errno = 9" when doing local network broadcasting

Viewed 883

Doing a little Jeopardy style Q&A here.

I'm developing an app in Flutter that uses the udp package for broadcasting on the local network. This has worked fine on Android, Windows, macOS and iOS until I tried on an iOS 14.6 device.

The code flow is mainly like this:

var endPoint = Endpoint.broadcast(port: Port(6000));
var udpFuture = UDP.bind(Endpoint.any(port: Port(6000)));
udpFuture.then((udp) {
   udp.listen((datagram) {
       handleMessage(datagram.data);
   });
   udp.send(bytesToSend, endPoint);
}

The error message I'm getting is this: Unhandled Exception: OS Error: Bad file descriptor, errno = 9

1 Answers
Related