Learn R Programming

nanonext (version 0.1.0)

send_aio: Send Async

Description

Send any number of R objects asynchronously over a Socket, with the ability to set (optional) send timeouts. For sending and receiving within R - objects are sent serialized to ensure perfect reproducibility.

Usage

send_aio(socket, ..., timeout)

Arguments

socket

a Socket.

...

one or more R objects to send (serialised) asynchronously.

timeout

in ms. If unspecified, a socket-specific default timeout will be used.

Value

A vector of zeros (invisibly) on success.

Details

Will block if the send is in progress and has not yet completed - certain protocol / transport combinations may limit the number of messages that can be queued if they have yet to be received. Set a timeout to ensure the function returns under all conditions.

Examples

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

send_aio(pub, data.frame(a = 1, b = 2), data.frame(c = 3, d = 4), timeout = 100)
out <- send_aio(pub, data.frame(a = 1, b = 2), data.frame(c = 3, d = 4), timeout = 100)
out

close(pub)

# }

Run the code above in your browser using DataLab