pub struct MultiInterfaceSocket { /* private fields */ }Expand description
Ipv4 udp socket with capability to send/receive packets on specific interfaces.
Implementations§
Source§impl MultiInterfaceSocket
impl MultiInterfaceSocket
pub fn bind_any() -> Result<Self>
pub fn bind_port(port: u16) -> Result<Self>
pub fn bind(addr: SocketAddrV4) -> Result<Self>
pub fn get_bind_addr(&self) -> Result<SocketAddrV4>
Sourcepub fn join_multicast_group(
&self,
addr: Ipv4Addr,
interface: Ipv4Addr,
) -> Result<()>
pub fn join_multicast_group( &self, addr: Ipv4Addr, interface: Ipv4Addr, ) -> Result<()>
Join a multicast group on provided interface.
Sourcepub fn leave_multicast_group(
&self,
addr: Ipv4Addr,
interface: Ipv4Addr,
) -> Result<()>
pub fn leave_multicast_group( &self, addr: Ipv4Addr, interface: Ipv4Addr, ) -> Result<()>
Leave a multicast group on provided interface.
Sourcepub fn set_nonblocking(&self, nonblocking: bool) -> Result<()>
pub fn set_nonblocking(&self, nonblocking: bool) -> Result<()>
Nonblocking mode will cause read operations to return immediately with an error if no data is available.
Sourcepub fn set_read_timeout(&self, timeout: Duration) -> Result<()>
pub fn set_read_timeout(&self, timeout: Duration) -> Result<()>
Assign a timeout to read operations on the socket.
Sourcepub fn set_read_timeout_inf(&self) -> Result<()>
pub fn set_read_timeout_inf(&self) -> Result<()>
When socket is non-blocking, this option will cause the read operation to block indefinitely until data is available.
Source§impl MultiInterfaceSocket
impl MultiInterfaceSocket
Sourcepub fn recv_from_iface<'a>(
&self,
buf: &'a mut [u8],
) -> Result<(&'a mut [u8], SocketAddrV4, u32)>
pub fn recv_from_iface<'a>( &self, buf: &'a mut [u8], ) -> Result<(&'a mut [u8], SocketAddrV4, u32)>
recvfrom, but with interface index.
pub fn send_to_iface( &self, buf: &[u8], addr: SocketAddrV4, iface_index: u32, _source_if_addr: IpAddr, ) -> Result<usize>
Auto Trait Implementations§
impl Freeze for MultiInterfaceSocket
impl RefUnwindSafe for MultiInterfaceSocket
impl Send for MultiInterfaceSocket
impl Sync for MultiInterfaceSocket
impl Unpin for MultiInterfaceSocket
impl UnwindSafe for MultiInterfaceSocket
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