android_multicast_lock

Creator: coderz1093

Last updated:

0 purchases

android_multicast_lock Image
android_multicast_lock Images

Languages

Categories

Add to Cart

Description:

android multicast lock

multicast_lock #
Flutter plugin adding ability to access MulticastLock which is required for receiving broadcast and multicast UDP packets
Example code #
pubspec.yaml:
...
dependencies:
multicast_lock: any
copied to clipboard
example dart code:
import 'package:multicast_lock/multicast_lock.dart';


void main() {
final multicastLock = new MulticastLock();
multicastLock.acquire();

// example listener code
final socket = await RawDatagramSocket.bind('224.0.0.1', 1900);
socket.multicastHops = 10;
socket.broadcastEnabled = true;
socket.writeEventsEnabled = true;
socket.listen((RawSocketEvent event) {
if (event == RawSocketEvent.read) {
final datagramPacket = _socket.receive();
if (datagramPacket == null) return;

print("packet!");
print(datagramPacket);
}});


// ...
// we should release lock after listening
multicastLock.release();
}

copied to clipboard

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.