pub struct UtpSocket<P: ConnectionPeer> { /* private fields */ }
Implementations§
Source§impl UtpSocket<SocketAddr>
impl UtpSocket<SocketAddr>
pub async fn bind(addr: SocketAddr) -> Result<Self>
Source§impl<P> UtpSocket<P>
impl<P> UtpSocket<P>
pub fn with_socket<S>(socket: S) -> Selfwhere
S: AsyncUdpSocket<P> + 'static,
pub fn cid(&self, peer_id: P::Id, is_initiator: bool) -> ConnectionId<P::Id>
Sourcepub fn num_connections(&self) -> usize
pub fn num_connections(&self) -> usize
Returns the number of connections currently open, both inbound and outbound.
Sourcepub async fn accept(&self, config: ConnectionConfig) -> Result<UtpStream<P>>
pub async fn accept(&self, config: ConnectionConfig) -> Result<UtpStream<P>>
WARNING: only accept() or accept_with_cid() can be used in an application. they aren’t compatible to use interchangeably in a program
Sourcepub async fn accept_with_cid(
&self,
cid: ConnectionId<P::Id>,
peer: Peer<P>,
config: ConnectionConfig,
) -> Result<UtpStream<P>>
pub async fn accept_with_cid( &self, cid: ConnectionId<P::Id>, peer: Peer<P>, config: ConnectionConfig, ) -> Result<UtpStream<P>>
WARNING: only accept() or accept_with_cid() can be used in an application. they aren’t compatible to use interchangeably in a program
pub async fn connect( &self, peer: Peer<P>, config: ConnectionConfig, ) -> Result<UtpStream<P>>
pub async fn connect_with_cid( &self, cid: ConnectionId<P::Id>, peer: Peer<P>, config: ConnectionConfig, ) -> Result<UtpStream<P>>
Trait Implementations§
Auto Trait Implementations§
impl<P> Freeze for UtpSocket<P>
impl<P> RefUnwindSafe for UtpSocket<P>
impl<P> Send for UtpSocket<P>
impl<P> Sync for UtpSocket<P>
impl<P> Unpin for UtpSocket<P>
impl<P> UnwindSafe for UtpSocket<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