receive.socket(rzmq)
receive.socket()所属R语言包:rzmq
Receive a message from the socket referenced by the socket argument .
接收消息从插座上,插座参数的引用。
译者:生物统计家园网 机器人LoveR
描述----------Description----------
The zmq_recv() function shall receive a message from the socket referenced by the socket argument. If there are no messages available on the specified socket the function shall block until the request can be satisfied.
zmq_recv()函数将收到一条消息,从插座上,插座参数的引用。如果没有任何消息可以在指定的插座的功能将阻塞,直到能满足要求。
用法----------Usage----------
receive.socket(socket)
receive.string(socket)
receive.int(socket)
receive.double(socket)
参数----------Arguments----------
参数:socket
a zmq socket object
ZMQ插座对象
值----------Value----------
the value sent from the remote server or NULL on failure.
发送的值从远程服务器或失败则返回NULL。
(作者)----------Author(s)----------
ZMQ was written by Martin Sustrik <sustrik@250bpm.com> and Martin Lucina <mato@kotelna.sk>.
rzmq was written by Whit Armstrong.
参考文献----------References----------
http://www.zeromq.org http://api.zeromq.org http://zguide.zeromq.org/page:all
参见----------See Also----------
connect.socket,bind.socket,receive.socket,send.socket
connect.socket,bind.socket,receive.socket,send.socket
实例----------Examples----------
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))
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|