pub struct IpSocket<P>where
P: IpProtocol,{ /* private fields */ }Expand description
Raw IPv4/IPv6 dualstack socket backed by AF_INET6.
Large packets are fragmented by the kernel by default.
There is no need to split the IpSocket into a reader and a writer,
because it does not need to borrow self mutably to call recv_from and send_to.
Just wrap it in Arc and clone it.
Implementations§
source§impl<P> IpSocket<P>where
P: IpProtocol,
impl<P> IpSocket<P>where
P: IpProtocol,
pub fn new(protocol: P) -> Result<Self>
pub fn new_with_fragment_config( protocol: P, fragment_config: FragmentConfig, ) -> Result<Self>
pub fn protocol(&self) -> c_int
pub async fn recv_from_ipv6(&self, buf: &mut [u8]) -> Result<(usize, Ipv6Addr)>
pub async fn recv_from(&self, buf: &mut [u8]) -> Result<(usize, IpAddr)>
pub async fn send_to_ipv6(&self, buf: &[u8], addr: &Ipv6Addr) -> Result<usize>
pub async fn send_to(&self, buf: &[u8], addr: &IpAddr) -> Result<usize>
Trait Implementations§
Auto Trait Implementations§
impl<P> Freeze for IpSocket<P>where
P: Freeze,
impl<P> !RefUnwindSafe for IpSocket<P>
impl<P> Send for IpSocket<P>where
P: Send,
impl<P> Sync for IpSocket<P>where
P: Sync,
impl<P> Unpin for IpSocket<P>where
P: Unpin,
impl<P> !UnwindSafe for IpSocket<P>
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