| 1 | suppressMessages(library(pbdZMQ, quietly = TRUE)) |
| 2 | |
| 3 | context <- zmq.ctx.new() |
| 4 | receiver <- zmq.socket(context, ZMQ.ST()$PULL) |
| 5 | zmq.connect(receiver, "tcp://localhost:5557") |
| 6 | |
| 7 | a1 <- zmq.poll(c(receiver), ZMQ.PO()$POLLIN) |
| 8 | print(a1) |
| 9 | |
| 10 | a2 <- tryCatch(zmq.poll(c(receiver), ZMQ.PO()$POLLIN), |
| 11 | interrupt = function(c) return(9), |
| 12 | error = function(c) return(99)) |
| 13 | print(a2) |
| 14 | |
| 15 | a3 <- tryCatch(zmq.poll(c(receiver), ZMQ.PO()$POLLIN, |
| 16 | MC = ZMQ.MC(check.eintr = TRUE)), |
| 17 | interrupt = function(c) return(9), |
| 18 | error = function(c) return(99)) |
| 19 | print(a3) |
| 20 | |
| 21 | a4 <- zmq.poll(c(receiver), ZMQ.PO()$POLLIN, |
| 22 | MC = ZMQ.MC(check.eintr = TRUE)) |
| 23 | print(a4) |
| 24 | print("This message should not be reached.") |
| 25 |