Tiempo de espera de Python Zeromq
import time
import zmq
context = zmq.Context()
sender = context.socket(zmq.PUSH)
sender.bind("tcp://127.0.0.1:5557")
# add this
sender.setsockopt(zmq.LINGER, 0)
sender.setsockopt(zmq.RCVTIMEO, 2000) # timeout after 2s
sender.setsockopt(zmq.SNDTIMEO, 2000) # timeout after 2s
###
# exemple
i=0
while True:
i=i+1
time.sleep(0.5)
print(f"sending message {i} ", end='')
try:
sender.send(i)
print("succeed")
except zmq.ZMQError as e:
print("failed")
CBT fan club