socket_connections.RdAdapt a socket handle to an R connection.
The returned connection can be passed to base R functions such as
readBin(), writeBin(), readLines(), and writeLines(). Closing the
connection does not close the underlying socket handle; call socket_close()
explicitly when the handle is no longer needed.
Uses R's connection dispatch, so this works with socket_connection() and
other readable R connections.
Uses R's connection dispatch, so this works with socket_connection() and
other writable R connections.
socket_connection(socket, close_socket = FALSE)
socket_connection_read(connection, n = 4096L)
socket_connection_write(connection, data)An R connection object.
A raw vector, possibly shorter than n at end-of-file.
Number of bytes written.
s <- socket_create()
con <- socket_connection(s)
close(con)
socket_close(s)