I have a question about this hypothetical situation.

The code below can throw a variety of exceptions.

For example, the listening socket can fail for some reason, or read from the client socket can fail for some reason.

I am interested in how to differentiate between errors for the listening socket and errors for the client socket.


---begin code---

import zmq
import time
import sys

context = zmq.Context()
socket = context.socket(zmq.REP)
socket.setsockopt(zmq.RCVTIMEO, 5000)

socket.bind("tcp://*:%s" % 5556)

while True:

    try:

        message = socket.recv_string() # line that can throw an exception

    except Exception:

        print("Exception occurred")

---end code---



Yuri


_______________________________________________
zeromq-dev mailing list
[email protected]
https://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to