if (FALSE) {
library(rzmq)
remote.exec <- function(out.socket,in.socket,fun,...) {
send.socket(out.socket,data=list(fun=fun,args=list(...)))
receive.socket(in.socket)
}
context = init.context()
out.socket = init.socket(context,"ZMQ_PUSH")
bind.socket(out.socket,"tcp://*:5557")
in.socket = init.socket(context,"ZMQ_PULL")
bind.socket(in.socket,"tcp://*:5558")
myfun <- function(x) {
sum(abs(x))
}
remote.exec(out.socket,in.socket,myfun,rnorm(1e3))
}
Run the code above in your browser using DataLab