Trying to use EPGM with ZeroMQ, PUB/SUB pattern, but can't receive message on client side. How to fix code? I am running this code on Ubuntu with wireless connection.
wlp2s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.1.122 netmask 255.255.255.0 broadcast 192.168.1.255
ip maddr show (Multicast addresses) inet 224.0.0.251 users 2 inet 224.0.0.1
publisher:
context = zmq.Context()
context.set(zmq.IO_THREADS, 1)
socket = context.socket(zmq.PUB)
socket.bind("epgm://192.168.1.122;224.0.0.251:5555")
# Allow clients to connect before sending data
while True:
data = struct.pack("q", time.perf_counter_ns())
socket.send(data)
print(data)
subscriber:
context = zmq.Context()
context.set(zmq.IO_THREADS, 1)
socket = context.socket(zmq.SUB)
socket.connect("epgm://192.168.1.122;224.0.0.251:5555")
socket.setsockopt(zmq.SUBSCRIBE, b"")
while True:
data = socket.recv()
print(data)
numbers.append((time.perf_counter_ns(), data))