I’ve a digital camera that’s alleged to be transferring a stay video stream to my flutter app by means of UDP packets (confirmed in Wireshark), however for some motive I am not receiving them.
The port quantity for the supply appears to randomly change every time I start a brand new stream, so I set the supply port quantity to 0, however I am one way or the other solely getting a WRITE occasion again.
Am I lacking one thing right here?
` Future<void> _getUdpData() async {
attempt {
remaining datagramSocket = await RawDatagramSocket.bind(InternetAddress.anyIPv4, 0);
datagramSocket.broadcastEnabled = true;
datagramSocket.readEventsEnabled = true;
print('Datagram socket able to obtain');
print('${datagramSocket.deal with.deal with}:${datagramSocket.port}');
datagramSocket.hear((RawSocketEvent occasion) {
print('Socket occasion: $occasion');
if (occasion == RawSocketEvent.learn) {
_handleReadEvent(datagramSocket);
}
});
} catch (occasion) {
print('Error retrieving information: $occasion');
}
}
void _handleReadEvent(RawDatagramSocket datagramSocket) {
Datagram? dg = datagramSocket.obtain();
if (dg != null) {
String message = String.fromCharCodes(dg.information).trim();
print('Datagram from ${dg.deal with.deal with}:${dg.port}: $message');
} else {
print('No datagram acquired.');
}
}`
All of the documentation I’ve discovered has had some model of the setup I have already got, so that is complicated the heck out of me.