libzmq
libzmq copied to clipboard
Endpoint in monitor event is not always the same as the endpoint of the socket
test.zip This was tested on macOS with ZeroMQ 4.3.2.
The file test .zip contains the code. You can run that on the same machine. It essentially is a pub server and a sub client. It is derived from your example.
- start the pub_server.py
- start the pub_client.py you will see the client will receive messages. And Also monitor messages about the connection.
- kill the pub_server.py while pub_client is still running you will see something like: Event: {'event': 512, 'value': 18, 'endpoint': b'tcp://localhost:5556', 'description': 'EVENT_DISCONNECTED'} Event: {'event': 4, 'value': 190, 'endpoint': b'tcp://127.0.0.1:5556', 'description': 'EVENT_CONNECT_RETRIED'}
So even though, it was connected to localhost, the endpoint returned by the monitor event becomes its IP after it gets disconnected. That makes this value quite useless (and caused a bug in my code) because one cannot rely on the fact that this endpoint is the one one used when connecting to the server socket.
I transferred this issue to zeromq/libzmq. cppzmq only passes through the values generated by libzmq.
@sigiesec Thank you. My bad.
Never mind :) The separation between cppzmq and libzmq is not obvious in all aspects.
This issue has been automatically marked as stale because it has not had activity for 365 days. It will be closed if no further activity occurs within 56 days. Thank you for your contributions.