|
17 | 17 | #' sent data. Set to FALSE for performance-critical applications where zero |
18 | 18 | #' will be returned (invisibly) instead. |
19 | 19 | #' |
20 | | -#' @return Raw vector of sent data, or zero (invisibly) if 'echo' is set to FALSE. |
| 20 | +#' @return Raw vector of sent data, or (invisibly) an integer exit code (zero on |
| 21 | +#' success) if 'echo' is set to FALSE. |
21 | 22 | #' |
22 | 23 | #' @examples |
23 | 24 | #' pub <- socket("pub", dial = "inproc://nanonext") |
@@ -56,12 +57,15 @@ send <- function(socket, |
56 | 57 | #' @param timeout in ms. If unspecified, a socket-specific default timeout will |
57 | 58 | #' be used. |
58 | 59 | #' |
59 | | -#' @return A send Aio (object of class 'sendAio'). |
| 60 | +#' @return A 'sendAio' (object of class 'sendAio'). |
60 | 61 | #' |
61 | | -#' @details Async send is always non-blocking and returns immediately. |
| 62 | +#' @details Async send is always non-blocking and returns a 'sendAio' |
| 63 | +#' immediately. |
62 | 64 | #' |
63 | | -#' The send result is available at \code{$result}, which will return an |
64 | | -#' 'unresolved' logical NA if the async operation is yet to complete. |
| 65 | +#' For a 'sendAio', the send result is available at \code{$result}. An |
| 66 | +#' 'unresolved' logical NA is returned if the async operation is yet to |
| 67 | +#' complete, The resolved value will be zero on success, or else an integer |
| 68 | +#' error code. |
65 | 69 | #' |
66 | 70 | #' To wait for and check the result of the send operation, use |
67 | 71 | #' \code{\link{call_aio}} on the returned 'sendAio' object. |
@@ -124,12 +128,17 @@ send_aio <- function(socket, data, mode = c("serial", "raw"), timeout) { |
124 | 128 | #' the converted data only. |
125 | 129 | #' |
126 | 130 | #' @return Named list of 2 elements: 'raw' containing the received raw vector |
127 | | -#' and 'data' containing the converted R object, or else the converted R |
128 | | -#' object if 'keep.raw' is set to FALSE. |
| 131 | +#' and 'data' containing the converted object, or else the converted object |
| 132 | +#' if 'keep.raw' is set to FALSE. |
129 | 133 | #' |
130 | | -#' @details In case of an error in unserialisation or data conversion, the |
131 | | -#' function will still return the received raw vector to allow the data to |
132 | | -#' be recovered. |
| 134 | +#' @details In case of an error, an integer 'errorValue' is returned (to be |
| 135 | +#' distiguishable from an integer message value). This can be verified using |
| 136 | +#' \code{\link{is_error_value}}. |
| 137 | +#' |
| 138 | +#' If the raw data was successfully received but an error occurred in |
| 139 | +#' unserialisation or data conversion (for example if the incorrect mode was |
| 140 | +#' specified), the received raw vector will always be returned to allow for |
| 141 | +#' the data to be recovered. |
133 | 142 | #' |
134 | 143 | #' @examples |
135 | 144 | #' s1 <- socket("bus", listen = "inproc://nanonext") |
@@ -179,19 +188,29 @@ recv <- function(socket, |
179 | 188 | #' @inheritParams recv |
180 | 189 | #' @inheritParams send_aio |
181 | 190 | #' |
182 | | -#' @return A recv Aio (object of class 'recvAio'). |
| 191 | +#' @return A 'recvAio' (object of class 'recvAio'). |
183 | 192 | #' |
184 | | -#' @details Async receive is always non-blocking and returns immediately. |
| 193 | +#' @details Async receive is always non-blocking and returns a 'recvAio' |
| 194 | +#' immediately. |
185 | 195 | #' |
186 | | -#' The received message is available at \code{$data}, and the raw message at |
187 | | -#' \code{$raw} (if kept). An 'unresolved' logical NA will be returned if the |
188 | | -#' async operation is yet to complete. |
| 196 | +#' For a 'recvAio', the received message is available at \code{$data}, and |
| 197 | +#' the raw message at \code{$raw} (if kept). An 'unresolved' logical NA is |
| 198 | +#' returned if the async operation is yet to complete. |
189 | 199 | #' |
190 | 200 | #' To wait for the async operation to complete and retrieve the received |
191 | 201 | #' message, use \code{\link{call_aio}} on the returned 'recvAio' object. |
192 | 202 | #' |
193 | 203 | #' Alternatively, to stop the async operation, use \code{\link{stop_aio}}. |
194 | 204 | #' |
| 205 | +#' In case of an error, an integer 'errorValue' is returned (to be |
| 206 | +#' distiguishable from an integer message value). This can be verified using |
| 207 | +#' \code{\link{is_error_value}}. |
| 208 | +#' |
| 209 | +#' If the raw data was successfully received but an error occurred in |
| 210 | +#' unserialisation or data conversion (for example if the incorrect mode was |
| 211 | +#' specified), the received raw vector will be stored at \code{$data} to |
| 212 | +#' allow for the data to be recovered. |
| 213 | +#' |
195 | 214 | #' @examples |
196 | 215 | #' s1 <- socket("pair", listen = "inproc://nanonext") |
197 | 216 | #' s2 <- socket("pair", dial = "inproc://nanonext") |
|
0 commit comments