pub struct SocketOptions<'a> { /* private fields */ }Expand description
Live get and set on an open socket.
use net_io::{Keepalive, Linger};
let conn = net_io::connect("127.0.0.1:7000")?;
conn.options().set_keepalive(Some(Keepalive::DEFAULT))?;
conn.options().set_linger(Linger::Abortive)?;
let effective = conn.options().set_receive_buffer(256 * 1024)?;
println!("receive buffer is {effective} bytes");Implementations§
Source§impl SocketOptions<'_>
impl SocketOptions<'_>
Sourcepub fn set_keepalive(&self, k: Option<Keepalive>) -> Result<(), NetError>
pub fn set_keepalive(&self, k: Option<Keepalive>) -> Result<(), NetError>
Sets keepalive probes (None = off).
§Errors
InvalidConfig for a zero value or a count above 255 on Windows; Os.
Sourcepub fn send_buffer(&self) -> Result<u32, NetError>
pub fn send_buffer(&self) -> Result<u32, NetError>
Sourcepub fn set_send_buffer(&self, bytes: u32) -> Result<u32, NetError>
pub fn set_send_buffer(&self, bytes: u32) -> Result<u32, NetError>
Sets SO_SNDBUF and returns the effective value (Linux doubles it).
§Errors
Os when the OS call fails.
Sourcepub fn receive_buffer(&self) -> Result<u32, NetError>
pub fn receive_buffer(&self) -> Result<u32, NetError>
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for SocketOptions<'a>
impl<'a> RefUnwindSafe for SocketOptions<'a>
impl<'a> Send for SocketOptions<'a>
impl<'a> Sync for SocketOptions<'a>
impl<'a> Unpin for SocketOptions<'a>
impl<'a> UnsafeUnpin for SocketOptions<'a>
impl<'a> UnwindSafe for SocketOptions<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more