Learn R Programming

nanonext (version 0.1.0)

send_vec: Send Vector

Description

Send vector data over a Socket. Data will be sent as binary without R serialisation, hence appropriate for interfacing with external programs.

Usage

send_vec(socket, data, block = FALSE, echo = TRUE)

Arguments

socket

a Socket.

data

a vector. Will be converted and sent as raw unless already a raw vector in which case it will be sent unmodified.

block

[default FALSE] logical flag whether to block until successful or return immediately even if unsuccessful (e.g. no connection available).

echo

[default TRUE] logical flag whether to return the raw vector of sent data. Set to FALSE for performance-critical applications where invisble NULL will be returned instead.

Value

Raw vector of sent data, or invisible NULL if 'echo' is set to FALSE.

Examples

Run this code
# NOT RUN {
pub <- socket("pub", dial = "inproc://nanonext")

send_vec(pub, c(10.1, 20.2, 30.3))

close(pub)

# }

Run the code above in your browser using DataLab