Skip to main content

set_socket_buffers

Function set_socket_buffers 

Source
pub fn set_socket_buffers(sock: &UdpSocket, bytes: usize) -> Result<()>
Expand description

Set the OS send and receive socket buffer sizes to bytes bytes on sock.

Raises SO_SNDBUF and SO_RCVBUF via setsockopt(2). The kernel may silently clamp or double the requested value (Linux doubles it to account for bookkeeping overhead), so callers should not assume the returned kernel value matches bytes exactly — only that the call succeeded.

This function lives in yip-io (the only crate where unsafe is permitted) so that the yipd daemon can stay #![forbid(unsafe_code)].