[zeromq-dev] Confusion around radio-dish.py

Yanone post at yanone.de
Tue Nov 10 08:54:11 CET 2020


Hellos,

I'm implementing a radio/dish in Python. I've successfully compiled libzmq and pyzmq with draft support.

Currently I'm having understanding issues around the example at https://github.com/zeromq/pyzmq/blob/master/examples/draft/radio-dish.py.

In that example, dish binds a port and radio connects to that port. 
But in my understanding, it should be the other way around. Isn't radio the sender and dish the receiver?

The example makes sense to me if I switch the radio and dish variable names while keeping the sockets, but then the socket types are confused.

A) This is the original example:
```
radio = ctx.socket(zmq.RADIO)
dish = ctx.socket(zmq.DISH)
dish.bind('udp://*:5556')
dish.join('numbers')
radio.connect('udp://127.0.0.1:5556')
```

B) This makes sense to me, switching only the variable names, leaving the confused sockets, but then also the `radio.join('numbers')` is off.
```
dish = ctx.socket(zmq.RADIO)
radio = ctx.socket(zmq.DISH)
radio.bind('udp://*:5556')
radio.join('numbers')
dish.connect('udp://127.0.0.1:5556')
```

C) This would be how it should work in my understanding:
```
dish = ctx.socket(zmq.DISH)
radio = ctx.socket(zmq.RADIO)
radio.bind('udp://*:5556')
dish.connect('udp://127.0.0.1:5556')
dish.join('numbers')
```

If the middle example (B) above were correct, it would mean that both the socket constants in pyzmq as well as the example is wrong.
Or the original example (A) is correct, but then I don't understand `dish.bind('udp://*:5556')` and `radio.connect('udp://127.0.0.1:5556')`. Doesn't the dish need the IP address to connect to something? What's with the wildcard?

Please help in lifting the confusion. Thank you!
Jan


More information about the zeromq-dev mailing list