Receive data over a Context [Deprecated].
recv_ctx(
context,
mode = c("serial", "character", "complex", "double", "integer", "logical", "numeric",
"raw"),
timeout = -2L,
keep.raw = TRUE
)
a Context.
<Sockets and Contexts> [default 'serial'] mode of vector to be received - one of 'serial', 'character', 'complex', 'double', 'integer', 'logical', 'numeric', or 'raw'. The default 'serial' means a serialised R object, for the other modes, the raw vector received will be converted into the respective mode. <Streams> [default 'character'] note that 'serial' is not an option for Streams.
(optional) integer value in milliseconds. If unspecified, the default of -2L uses a socket-specific default, which is usually the same as no timeout.
[default TRUE] logical flag whether to keep the received raw vector (useful for verification e.g. via hashing). If FALSE, will return the converted data only.
Named list of 2 elements: 'raw' containing the received raw vector and 'data' containing the converted object, or else the converted object if 'keep.raw' is set to FALSE.
Will block while awaiting the receive operation to complete. Set a timeout to ensure that the function returns under all scenarios.
In case of an error, an integer 'errorValue' is returned (to be
distiguishable from an integer message value). This can be verified using
is_error_value
.
If the raw data was successfully received but an error occurred in unserialisation or data conversion (for example if the incorrect mode was specified), the received raw vector will always be returned to allow for the data to be recovered.