PageRenderTime 66ms CodeModel.GetById 21ms RepoModel.GetById 2ms app.codeStats 0ms

/man/receive.socket.Rd

https://github.com/brotchie/rzmq
Unknown | 66 lines | 57 code | 9 blank | 0 comment | 0 complexity | ee43cd552c347fcf17655a7df6d284ee MD5 | raw file
  1. \name{receive.socket}
  2. \alias{receive.socket}
  3. \alias{receive.null.msg}
  4. \alias{receive.string}
  5. \alias{receive.int}
  6. \alias{receive.double}
  7. \title{
  8. Receive a message from the socket referenced by the socket argument .
  9. }
  10. \description{
  11. The zmq_recv() function shall receive a message from the socket
  12. 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.
  13. }
  14. \usage{
  15. receive.socket(socket, unserialize=TRUE)
  16. receive.null.msg(socket)
  17. receive.string(socket)
  18. receive.int(socket)
  19. receive.double(socket)
  20. }
  21. \arguments{
  22. \item{socket}{a zmq socket object}
  23. \item{unserialize}{whether to call unserialize on the received data}
  24. }
  25. \value{
  26. the value sent from the remote server or NULL on failure.
  27. or a logical for receive.null.msg indicating whether the msg was zero size.
  28. }
  29. \references{
  30. http://www.zeromq.org
  31. http://api.zeromq.org
  32. http://zguide.zeromq.org/page:all
  33. }
  34. \author{
  35. ZMQ was written by Martin Sustrik <sustrik@250bpm.com> and Martin Lucina <mato@kotelna.sk>.
  36. rzmq was written by Whit Armstrong.
  37. }
  38. \seealso{
  39. \code{\link{connect.socket},\link{bind.socket},\link{receive.socket},\link{send.socket},\link{poll.socket}}
  40. }
  41. \examples{\dontrun{
  42. library(rzmq)
  43. remote.exec <- function(out.socket,in.socket,fun,...) {
  44. send.socket(out.socket,data=list(fun=fun,args=list(...)))
  45. receive.socket(in.socket)
  46. }
  47. context = init.context()
  48. out.socket = init.socket(context,"ZMQ_PUSH")
  49. bind.socket(out.socket,"tcp://*:5557")
  50. in.socket = init.socket(context,"ZMQ_PULL")
  51. bind.socket(in.socket,"tcp://*:5558")
  52. myfun <- function(x) {
  53. sum(abs(x))
  54. }
  55. remote.exec(out.socket,in.socket,myfun,rnorm(1e3))
  56. }}
  57. \keyword{utilities}