pub struct Client { /* private fields */ }Expand description
A polling-based socket object which manages outbound uflow connections.
Implementations
sourceimpl Client
impl Client
sourcepub fn bind<A: ToSocketAddrs>(addr: A) -> Result<Self, Error>
pub fn bind<A: ToSocketAddrs>(addr: A) -> Result<Self, Error>
Opens a UDP socket and creates a corresponding Client object. The UDP socket is
bound to the provided address, and configured to be non-blocking. Any errors resulting from
socket initialization are forwarded to the caller.
sourcepub fn bind_any_ipv4() -> Result<Self, Error>
pub fn bind_any_ipv4() -> Result<Self, Error>
Equivalent to calling bind() with
(std::net::Ipv4Addr::UNSPECIFIED, 0).
sourcepub fn bind_any_ipv6() -> Result<Self, Error>
pub fn bind_any_ipv6() -> Result<Self, Error>
Equivalent to calling bind() with
(std::net::Ipv6Addr::UNSPECIFIED, 0).
sourcepub fn connect<A: ToSocketAddrs>(
&mut self,
addr: A,
cfg: Config
) -> Result<Peer, Error>
pub fn connect<A: ToSocketAddrs>(
&mut self,
addr: A,
cfg: Config
) -> Result<Peer, Error>
Initiates a connection to a remote host at the specified address, and returns a
Peer object representing the connection. Any errors resulting from address
resolution are forwarded to the caller.
sourcepub fn step(&mut self)
pub fn step(&mut self)
Processes UDP frames received since the last call to step(), and
sends any pending outbound frames (acknowledgements, keep-alives, packet data, etc.).
Current, non-zombie Peer objects will be updated as relevant data is
received. Call Peer::poll_events() after calling this method
to retrieve incoming packets and connection status updates for an individual peer.
sourcepub fn flush(&mut self)
pub fn flush(&mut self)
Sends any pending outbound frames (acknowledgements, keep-alives, packet data, etc.).
sourcepub fn address(&self) -> SocketAddr
pub fn address(&self) -> SocketAddr
Returns the local address of the internal UDP socket.
Auto Trait Implementations
impl !RefUnwindSafe for Client
impl !Send for Client
impl !Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more