Debian Codegraph @

inst/examples/reqrep/client.r

raw symbols SCIP
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 <- zmq.ctx.new()
6 socket <- zmq.socket(ctxt, ZMQ.ST()$REQ)
7 zmq.connect(socket, "tcp://localhost:55555")
8
9 sendrecv <- function(socket, data)
10 {
11 zmq.msg.send(data, socket)
12 zmq.msg.recv(socket)
13 }
14
15 cat("Send commands to the server using sendrecv().\nFor example, 'sendrecv(socket, \"1+1\")'.\nSend 'sendrecv(socket, \"EXIT\")' to shut down the server.\n\n")