These helpers read or set frequently used socket options. With the value argument omitted, the current option value is returned; otherwise the option is updated and the socket handle is returned invisibly. The socket_linger() helper uses on and seconds to configure SO_LINGER.

socket_reuse_address(socket, value)

socket_keep_alive(socket, value)

socket_broadcast(socket, value)

socket_no_delay(socket, value)

socket_quick_ack(socket, value)

socket_receive_buffer_size(socket, value)

socket_send_buffer_size(socket, value)

socket_receive_timeout(socket, value)

socket_send_timeout(socket, value)

socket_linger(socket, on, seconds = 0L)

Arguments

socket

A socketR socket handle.

value

Optional option value to set. Its type depends on the helper: logical, integer, or numeric seconds.

on

Optional logical linger enable flag.

seconds

Linger duration in seconds.

Value

The option value when reading; invisibly, the socket when setting.

Examples

s <- socket_create()
socket_reuse_address(s, TRUE)
socket_reuse_address(s)
#> [1] TRUE
socket_close(s)