i use SocketType.sub and SocketType.pub to connect and bind from udp address
i watched documentation of zmq and i must use socket type as like Radio and Dish but i can't find it in dartzmq
my simple code like this :
import 'dart:io';
import 'package:dartzmq/dartzmq.dart';
void dishRadioDart() async {
String udpAddress = "udp://127.0.0.1:5566";
final context = ZContext();
final dishSocket = context.createSocket(SocketType.pub);
final radioSocket = context.createSocket(SocketType.sub);
try {
dishSocket.bind(udpAddress);
print("dish socket binded to address : ${udpAddress}");
radioSocket.connect(udpAddress);
print("radio socket connect to address : ${udpAddress}");
radioSocket.setOption(ZMQ_SUBSCRIBE, "");
radioSocket.payloads.listen((event) {
print("received message");
print("received message is : ${event}");
});
while (true) {
print("send message ");
dishSocket.sendString("abdullah message ");
sleep(const Duration(seconds: 1));
}
} catch (e) {
print("error e : ${e}");
}
}
i use SocketType.sub and SocketType.pub to connect and bind from udp address i watched documentation of zmq and i must use socket type as like Radio and Dish but i can't find it in dartzmq
my simple code like this :