PageRenderTime 53ms CodeModel.GetById 25ms RepoModel.GetById 0ms app.codeStats 0ms

/man/send.socket.Rd

https://github.com/brotchie/rzmq
Unknown | 59 lines | 53 code | 6 blank | 0 comment | 0 complexity | 9ffac2259b7e47f2eff7d919bb56e74b MD5 | raw file
  1. \name{send.socket}
  2. \alias{send.socket}
  3. \alias{send.null.msg}
  4. \title{
  5. send a message.
  6. }
  7. \description{
  8. Queue the message referenced by the msg argument to be sent to the socket referenced by the socket argument.
  9. A successful invocation of send.socket does not indicate that the message has been transmitted to the network, only that it has been queued on the socket and ZMQ has assumed responsibility for the message.
  10. }
  11. \usage{
  12. send.socket(socket, data, send.more=FALSE, serialize=TRUE)
  13. send.null.msg(socket, send.more=FALSE)
  14. }
  15. \arguments{
  16. \item{socket}{a zmq socket object}
  17. \item{data}{the R object to be sent}
  18. \item{send.more}{whether this message has more frames to be sent}
  19. \item{serialize}{whether to call serialize before sending the data}
  20. }
  21. \value{
  22. a boolean indicating success or failure of the operation.
  23. }
  24. \references{
  25. http://www.zeromq.org
  26. http://api.zeromq.org
  27. http://zguide.zeromq.org/page:all
  28. }
  29. \author{
  30. ZMQ was written by Martin Sustrik <sustrik@250bpm.com> and Martin Lucina <mato@kotelna.sk>.
  31. rzmq was written by Whit Armstrong.
  32. }
  33. \seealso{
  34. \code{\link{connect.socket},\link{bind.socket},\link{receive.socket},\link{send.socket},\link{poll.socket}}
  35. }
  36. \examples{\dontrun{
  37. ## remote execution server in rzmq
  38. library(rzmq)
  39. context = init.context()
  40. in.socket = init.socket(context,"ZMQ_PULL")
  41. bind.socket(in.socket,"tcp://*:5557")
  42. out.socket = init.socket(context,"ZMQ_PUSH")
  43. bind.socket(out.socket,"tcp://*:5558")
  44. while(1) {
  45. msg = receive.socket(in.socket)
  46. fun <- msg$fun
  47. args <- msg$args
  48. print(args)
  49. ans <- do.call(fun,args)
  50. send.socket(out.socket,ans)
  51. }
  52. }}
  53. \keyword{utilities}