Debian Codegraph @

man/b1_sendrecvfile.Rd

raw
1 % Generated by roxygen2: do not edit by hand
2 % Please edit documentation in R/R_zmq_transfer.r
3 \name{File Transfer Functions}
4 \alias{File Transfer Functions}
5 \alias{zmq.sendfile}
6 \alias{zmq.recvfile}
7 \title{File Transfer Functions}
8 \usage{
9 zmq.sendfile(
10 port,
11 filename,
12 verbose = FALSE,
13 flags = ZMQ.SR()$BLOCK,
14 forcebin = FALSE,
15 ctx = NULL,
16 socket = NULL
17 )
18
19 zmq.recvfile(
20 port,
21 endpoint,
22 filename,
23 verbose = FALSE,
24 flags = ZMQ.SR()$BLOCK,
25 forcebin = FALSE,
26 ctx = NULL,
27 socket = NULL
28 )
29 }
30 \arguments{
31 \item{port}{A valid tcp port.}
32
33 \item{filename}{The name (as a string) of the in/out files. The in and out file names
34 can be different.}
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{forcebin}{Force to read/send/recv/write in binary form. Typically for a Windows
42 system, text (ASCII) and binary files are processed differently.
43 If \code{TRUE}, "r+b" and "w+b" will be enforced in the C code.
44 This option is mainly for Windows.}
45
46 \item{ctx}{A ZMQ ctx. If \code{NULL} (default), the function will initial one at
47 the beginning and destroy it after finishing file transfer.}
48
49 \item{socket}{A ZMQ socket based on \code{ctx}.
50 If \code{NULL} (default), the function will create one at the beginning
51 and close it after finishing file transfer.}
52
53 \item{endpoint}{A ZMQ socket endpoint.}
54 }
55 \value{
56 \code{zmq.sendfile()} and \code{zmq.recvfile()} return
57 number of bytes (invisible) in the sent message if successful,
58 otherwise returns -1 (invisible) and sets \code{errno} to the error
59 value, see ZeroMQ manual for details.
60 }
61 \description{
62 High level functions calling \code{zmq_send()} and \code{zmq_recv()}
63 to transfer a file in 200 KiB chunks.
64 }
65 \details{
66 If no socket is passed, then by default \code{zmq.sendfile()} binds a
67 \code{ZMQ_PUSH} socket, and \code{zmq.recvfile()} connects to this with a
68 \code{ZMQ_PULL} socket. On the other hand, a PUSH/PULL, REQ/REP, or REP/REQ
69 socket pairing may be passed. In that case, the socket should already be
70 connected to the desired endpoint. Be careful not to pass the wrong socket
71 combination (e.g., do not do REQ/REQ), as this can put the processes in an
72 un-recoverable state.
73 }
74 \examples{
75 \dontrun{
76 ### Run the sender and receiver code in separate R sessions.
77
78 # Receiver
79 library(pbdZMQ, quietly = TRUE)
80 zmq.recvfile(55555, "localhost", "/tmp/outfile", verbose=TRUE)
81
82 # Sender
83 library(pbdZMQ, quietly = TRUE)
84 zmq.sendfile(55555, "/tmp/infile", verbose=TRUE)
85 }
86
87 }
88 \references{
89 ZeroMQ/4.1.0 API Reference:
90 \url{https://libzmq.readthedocs.io/en/zeromq4-1/}
91
92 Programming with Big Data in R Website: \url{https://pbdr.org/}
93 }
94 \seealso{
95 \code{\link{zmq.msg.send}()}, \code{\link{zmq.msg.recv}()}.
96 }
97 \author{
98 Drew Schmidt and Christian Heckendorf
99 }
100 \keyword{programming}