sockets - zmq send with NOBLOCK raise Resource temporarily unavailable -
This code will temporarily increase the unavailable resource when calling with Noble:
context = Zmq reference () sender = reference signal (zmq.PUSH) sender.bind ('tcp: // *: 15556') sender. Send ('KeEpAliv', zmq.NOBLOCK) # This line will throw exception # sender.send ( 'Kepalive') # This line will be fine after reading After reading, I did not get any signal for this. But explained this flag.
Python wrapper raise zmq.error.Again if the underlying C API returns < Code> EAGAIN . Now, you should follow the documentation, which states:
ZMQ_NOBLOCK
Specifies that the operation should be performed in non-blocked mode. If the message can not be queued on the socket, the zmq_send () function will fail in the EAGAN from an anonymous set.
In addition, in the Errors section:
EAGN - non-blocking mode was requested and message can not be sent at this time.
Now, why is not it possible to send a message? On the description page we can read the following about the PUSH socket: To create this queue when a colleague joins it, if this coworker is disconnected , The push socket will destroy its line and release any message from it.
Before your socket with any colleague, there is nowhere to send messages, and there is no queue. Thus, only 2 things can be possible:
- If you call
send () in the blocking mode, by the time someone joins a co-worker, - Send
Send () to non-blocking mode if you call zmq.error.Again raises, nothing can be done with the message and you should try again later. Note that you can also get this exception if the queue for each connector is complete ( PUSH socket for each connected pire, a separate queue makes) .
Comments
Post a Comment