Flushing ZMQ pipe before use?

Hi all
this is very strange. I am using ZMQ and after I have finished with it I shut it down using close BUT when I start it up again there’s “END” in there???

using ZMQ
context = Context()
socket = Socket(context, PULL)
ZMQ.bind(socket, "tcp://*:5555")

while true 
do some stuff looking at messages

if message == "END"

I “kill” it using this which I “thought” would flush the buffer/socket when I close the PULL

using ZMQ
context = Context()
stk_socket = Socket(context, PUSH)
ZMQ.connect(stk_socket, "tcp://localhost:5555")

Is there a FLUSH function in ZMQ that I can call in the PULL? to flush anything out of the socket?

From the ZMQ FAQ:

How can I flush all messages that are in the ZeroMQ socket queue? There is no explicit command for flushing a specific message or all messages from the message queue. You may set ZMQ_LINGER to 0 and close the socket to discard any unsent messages.

1 Like

hmm seems I should have done SOME research in the “HIDDEN” area called ZMQ FAQ. They could have gone the extra mile and called it “THIS IS FOR THE LAZY AND INDOLENT” :wink:
sorry about that @stevengj BUT it does say that I should close everything down, which I do on terminating the script. ALSO I check the status of the ports

sudo lsof -i -P -n | grep LISTEN

and it’s all gone bye bye as 5555 has no listeners. Ho hum back into the dog house for me and it’s only 9:30am

thanks again.