| 1 | if (!interactive()) |
| 2 | stop("Please run the client interactively; you can do so by executing 'source(\"client.r\")' from an interactive R session.") |
| 3 | |
| 4 | library(pbdZMQ) |
| 5 | ctxt <- init.context() |
| 6 | socket <- init.socket(ctxt, "ZMQ_REQ") |
| 7 | connect.socket(socket, "tcp://localhost:55555") |
| 8 | |
| 9 | sendrecv <- function(socket, data) |
| 10 | { |
| 11 | send.socket(socket, data) |
| 12 | receive.socket(socket) |
| 13 | } |
| 14 | |
| 15 | cat("Send commands to the server using sendrecv(). For example, 'sendrecv(socket, \"1+1\")'. Send 'sendrecv(socket, \"EXIT\")' to shut down the server.\n\n") |