The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.
pbdZMQ is an R package providing a simplified interface to ZeroMQ with a focus on client/server programming frameworks. Notably, pbdZMQ should allow for the use of ZeroMQ on Windows platforms.
The package contains 2 separate interfaces:
The primary focus of pbdZMQ is for building client/server interfaces for R. An example of this can be found in the pbdCS package, which uses this model to control batch MPI servers interactively. There are also several illustrative examples in the pbdZMQ package vignette.
The basic idea is that you need a server R process, and a separate client R process. For demonstration/simplicity, assume they are both running on the same machine. The server we describe here is very basic. You can see a more detailed example in the pbdZMQ package vignette.
Save the following as, say, server.r
and run it in batch
by running Rscript server.r
from a terminal.
library(pbdZMQ)
<- init.context()
ctxt <- init.socket(ctxt, "ZMQ_REP")
socket bind.socket(socket, "tcp://*:55555")
cat("Client command: ")
<- receive.socket(socket)
msg
cat(msg, "\n")
send.socket(socket, "Message received!")
From an interactive R session (not in batch), enter the following:
library(pbdZMQ)
<- init.context()
ctxt <- init.socket(ctxt, "ZMQ_REQ")
socket connect.socket(socket, "tcp://localhost:55555")
send.socket(socket, "1+1")
receive.socket(socket)
If all goes well, your message should be sent from the client to the server, before your server terminates.
For an example of how to do this more persistently, see the pbdZMQ package vignette.
pbdZMQ requires
A distribution of libzmq is shipped with pbdZMQ for convenience.
However, if you already have a system installation of ZeroMQ, then it is
simple to use that with pbdZMQ. Full details on installation and
troubleshooting can be found in the package vignette, located at
inst/doc/pbdZMQ-guide.pdf
of the pbdZMQ source tree.
The package can be installed from the CRAN via the usual
install.packages("pbdZMQ")
, or via the devtools
package:
library(devtools)
install_github("RBigData/pbdZMQ")
When mentioning the pbdZMQ, please cite:
@MISC{pbdZMQ2015,
author = {Chen, W.-C. and Schmidt, D. and Heckendorf, C. and Ostrouchov, G.},
title = {pbdZMQ: Programming with Big Data -- Interface to ZeroMQ},
year = {2015},
note = {R Package, URL https://cran.r-project.org/package=pbdZMQ}
}
pbdZMQ is authored and maintained by:
With additional contributions and authors from:
For the distribution of ZeroMQ that is shipped with pbdZMQ, you can
find details of authorship and copyright in
inst/zmq_copyright/
of the pbdZMQ source tree, or under
zmq_copyright/
of a binary installation of pbdZMQ.
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.