[−][src]Struct uds::nonblocking::UnixSeqpacketListener
A non-blocking unix domain listener for sequential-packet connections.
Differs from UnixSeqpacketListener
in that accept()
returns non-blocking connection sockets
and doesn't block if no client connect()
ions are pending.
This type can be used with mio if the mio
feature is enabled:
uds = { version = "x.y", features=["mio"] }
Examples
use uds::nonblocking::{UnixSeqpacketListener, UnixSeqpacketConn}; use std::io::ErrorKind; let listener = UnixSeqpacketListener::bind("nonblocking_seqpacket_listener.socket") .expect("Cannot create nonblocking seqpacket listener"); // doesn't block if no connections are waiting: assert_eq!(listener.accept_unix_addr().unwrap_err().kind(), ErrorKind::WouldBlock); // returned connections are nonblocking: let _client = UnixSeqpacketConn::connect("nonblocking_seqpacket_listener.socket").unwrap(); let (conn, _addr) = listener.accept_unix_addr().unwrap(); assert_eq!(conn.recv(&mut[0u8; 20]).unwrap_err().kind(), ErrorKind::WouldBlock);
Implementations
impl NonblockingUnixSeqpacketListener
[src]
pub fn bind<P: AsRef<Path>>(path: P) -> Result<Self, Error>
[src]
Connect to an unix seqpacket server listening at path
.
This is a wrapper around connect_unix_addr()
for convenience and compatibility with std.
pub fn bind_unix_addr(addr: &UnixSocketAddr) -> Result<Self, Error>
[src]
accept_unix_addr()
doesn't block if no connections are waiting:
let _ = std::fs::remove_file("nonblocking_seqpacket_listener.socket"); let listener = UnixSeqpacketListener::bind("nonblocking_seqpacket_listener.socket") .expect("Cannot create nonblocking seqpacket listener"); assert_eq!(listener.accept_unix_addr().unwrap_err().kind(), ErrorKind::WouldBlock); std::fs::remove_file("nonblocking_seqpacket_listener.socket").unwrap();
pub fn local_unix_addr(&self) -> Result<UnixSocketAddr, Error>
[src]
Get the address this listener was bound to.
pub fn accept_unix_addr(
&self
) -> Result<(NonblockingUnixSeqpacketConn, UnixSocketAddr), Error>
[src]
&self
) -> Result<(NonblockingUnixSeqpacketConn, UnixSocketAddr), Error>
Accept a non-blocking connection, non-blockingly.
pub fn try_clone(&self) -> Result<Self, Error>
[src]
Create a new file descriptor listening for the same connections.
Trait Implementations
impl AsRawFd for NonblockingUnixSeqpacketListener
[src]
impl Debug for NonblockingUnixSeqpacketListener
[src]
impl Drop for NonblockingUnixSeqpacketListener
[src]
impl Evented for NonblockingUnixSeqpacketListener
[src]
fn register(
&self,
poll: &Poll,
token: Token_06,
interest: Ready,
opts: PollOpt
) -> Result<(), Error>
[src]
&self,
poll: &Poll,
token: Token_06,
interest: Ready,
opts: PollOpt
) -> Result<(), Error>
fn reregister(
&self,
poll: &Poll,
token: Token_06,
interest: Ready,
opts: PollOpt
) -> Result<(), Error>
[src]
&self,
poll: &Poll,
token: Token_06,
interest: Ready,
opts: PollOpt
) -> Result<(), Error>
fn deregister(&self, poll: &Poll) -> Result<(), Error>
[src]
impl FromRawFd for NonblockingUnixSeqpacketListener
[src]
unsafe fn from_raw_fd(fd: RawFd) -> Self
[src]
impl IntoRawFd for NonblockingUnixSeqpacketListener
[src]
fn into_raw_fd(self) -> RawFd
[src]
impl Source for NonblockingUnixSeqpacketListener
[src]
fn register(
&mut self,
registry: &Registry,
token: Token_07,
interest: Interest
) -> Result<(), Error>
[src]
&mut self,
registry: &Registry,
token: Token_07,
interest: Interest
) -> Result<(), Error>
fn reregister(
&mut self,
registry: &Registry,
token: Token_07,
interest: Interest
) -> Result<(), Error>
[src]
&mut self,
registry: &Registry,
token: Token_07,
interest: Interest
) -> Result<(), Error>
fn deregister(&mut self, registry: &Registry) -> Result<(), Error>
[src]
impl<'a> Source for &'a NonblockingUnixSeqpacketListener
[src]
Auto Trait Implementations
impl RefUnwindSafe for NonblockingUnixSeqpacketListener
impl Send for NonblockingUnixSeqpacketListener
impl Sync for NonblockingUnixSeqpacketListener
impl Unpin for NonblockingUnixSeqpacketListener
impl UnwindSafe for NonblockingUnixSeqpacketListener
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,