Debian Codegraph @

man/b2_sendrecvdir.Rd

raw
1 % Generated by roxygen2: do not edit by hand
2 % Please edit documentation in R/R_zmq_transfers.r
3 \name{Transfer Functions for Files or Directories}
4 \alias{Transfer Functions for Files or Directories}
5 \alias{zmq.senddir}
6 \alias{zmq.recvdir}
7 \title{Transfer Functions for Files or Directories}
8 \usage{
9 zmq.senddir(
10 port,
11 infiles,
12 verbose = FALSE,
13 flags = ZMQ.SR()$BLOCK,
14 ctx = NULL,
15 socket = NULL
16 )
17
18 zmq.recvdir(
19 port,
20 endpoint,
21 outfile = NULL,
22 exdir = NULL,
23 verbose = FALSE,
24 flags = ZMQ.SR()$BLOCK,
25 ctx = NULL,
26 socket = NULL
27 )
28 }
29 \arguments{
30 \item{port}{A valid tcp port to be passed to \code{zmq.sendfile()} and
31 \code{zmq.recvfile()}.}
32
33 \item{infiles}{The name (as a string) vector of the in files to be zipped and to be
34 sent away.}
35
36 \item{verbose}{Logical; determines if a progress bar should be shown.}
37
38 \item{flags}{A flag for the method used by \code{zmq_sendfile} and
39 \code{zmq_recvfile}}
40
41 \item{ctx}{A ZMQ ctx. If \code{NULL} (default), the function will initial one at
42 the beginning and destroy it after finishing file transfer.}
43
44 \item{socket}{A ZMQ socket based on \code{ctx}.
45 If \code{NULL} (default), the function will create one at the beginning
46 and close it after finishing file transfer.}
47
48 \item{endpoint}{A ZMQ socket endpoint to be passed to \code{zmq.sendfile()} and
49 \code{zmq.recvfile()}.}
50
51 \item{outfile}{The name (as a string) of the out file to be saved on the disk.
52 If \code{outfile = NULL} and \code{exdir = NULL}, a tempfile will be
53 used and the tempfile nanme will be returned.}
54
55 \item{exdir}{The name (as a string) of the out directory to save the unzip files
56 unzipped from the received \code{outfile}.}
57 }
58 \value{
59 \code{zmq.senddir()} and \code{zmq.recvdir()} return
60 number of bytes (invisible) in the sent message if successful,
61 otherwise returns -1 (invisible) and sets \code{errno} to the error
62 value, see ZeroMQ manual for details.
63 In addition, \code{zmq.recvdir()} returns a zipped file name in a list.
64 }
65 \description{
66 High level functions calling \code{zmq.sendfile()} and \code{zmq.recvfile()}
67 to zip, transfer, and unzip small files or directories contains small files.
68 }
69 \details{
70 \code{zmq.senddir()} calls \code{zmq.senddir()}, and
71 \code{zmq.recvdir()} calls \code{zmq.recvdir()}.
72 }
73 \examples{
74 \dontrun{
75 ### Run the sender and receiver code in separate R sessions.
76
77 ### Receiver
78 library(pbdZMQ, quietly = TRUE)
79 zmq.recvdir(55555, "localhost", outfile = "./backup_2019.zip",
80 verbose = TRUE)
81 ### or unzip to exdir
82 # zmq.recvdir(55555, "localhost", exdir = "./backup_2019", verbose = TRUE)
83
84 ### Sender
85 library(pbdZMQ, quietly = TRUE)
86 zmq.senddir(55555, c("./pbdZMQ/R", "./pbdZMQ/src"), verbose = TRUE)
87 }
88
89 }
90 \references{
91 ZeroMQ/4.1.0 API Reference:
92 \url{https://libzmq.readthedocs.io/en/zeromq4-1/}
93
94 Programming with Big Data in R Website: \url{https://pbdr.org/}
95 }
96 \seealso{
97 \code{\link{zmq.sendfile}()}, \code{\link{zmq.recvfile}()}.
98 }
99 \author{
100 Wei-Chen Chen
101 }
102 \keyword{programming}