R: File Transfer Functions

File Transfer Functions {pbdZMQ} | R Documentation

## File Transfer Functions

### Description

High level functions calling `zmq_send()` and `zmq_recv()` to transfer a file in 200 KiB chunks.

### Usage

    zmq.sendfile(port, filename, verbose = FALSE, flags = .pbd_env$ZMQ.SR$BLOCK)

    zmq.recvfile(port, endpoint, filename, verbose = FALSE,
      flags = .pbd_env$ZMQ.SR$BLOCK)

### Arguments

`port` | A valid tcp port.
`filename` | The name (as a string) of the in/out files.
`verbose` | logical; determines if a progress bar should be shown.
`flags` | a flag for the method used by `zmq_sendfile` and `zmq_recvfile`
`endpoint` | A ZMQ socket endpoint.

### Details

`zmq.sendfile()` binds a `ZMQ_PUSH` socket, and `zmq.recvfile()` connects to this with a `ZMQ_PULL` socket.

### Value

`zmq.sendfile()` and `zmq.recvfile()` return number of bytes (invisible) in the sent message if successful, otherwise returns -1 (invisible) and sets `errno` to the error value, see ZeroMQ manual for details.

### Author(s)

Drew Schmidt and Christian Heckendorf

### References

ZeroMQ/4.1.0 API Reference: http://api.zeromq.org/4-1:_start

Programming with Big Data in R Website: http://r-pbd.org/

### See Also

`zmq.msg.send()`, `zmq.msg.recv()`.

### Examples

    ## Not run:
    ### Run the sender and receiver code in separate R sessions.

    # Receiver
    library(pbdZMQ, quietly = TRUE)
    zmq.recvfile(55555, "localhost", "/tmp/outfile", verbose=TRUE)

    # Sender
    library(pbdZMQ, quietly = TRUE)
    zmq.sendfile(55555, "/tmp/infile", verbose=TRUE)

    ## End(Not run)

[Package pbdZMQ version 0.3-2 Index]