pub struct SrtSocket { /* private fields */ }Available on crate feature
tokio only.Expand description
A handle to an established SRT connection over UDP.
Created by SrtSocket::connect (caller role) or
SrtListener::accept (listener role). The protocol itself runs on a
background tokio task the handle owns; send enqueues an
application payload and recv awaits a delivered one.
Dropping the handle aborts the driver task.
Implementations§
Source§impl SrtSocket
impl SrtSocket
Sourcepub async fn connect<A: ToSocketAddrs>(
remote_addr: A,
config: HandshakeConfig,
) -> Result<Self>
pub async fn connect<A: ToSocketAddrs>( remote_addr: A, config: HandshakeConfig, ) -> Result<Self>
Connect to a remote SRT peer as a Caller.
Sourcepub async fn connect_from<A: ToSocketAddrs>(
local_addr: SocketAddr,
remote_addr: A,
config: HandshakeConfig,
) -> Result<Self>
pub async fn connect_from<A: ToSocketAddrs>( local_addr: SocketAddr, remote_addr: A, config: HandshakeConfig, ) -> Result<Self>
Connect from a specific local address.
Sourcepub async fn send(&mut self, payload: &[u8]) -> Result<()>
pub async fn send(&mut self, payload: &[u8]) -> Result<()>
Enqueue a payload for transmission to the peer.
Returns immediately once the payload is handed to the driver task — actual transmission, ACK/NAK handling, and retransmission all happen on that task. Fails only if the driver task has stopped (peer shut down or connection error).
Sourcepub fn peer_addr(&self) -> SocketAddr
pub fn peer_addr(&self) -> SocketAddr
The peer’s socket address.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SrtSocket
impl RefUnwindSafe for SrtSocket
impl Send for SrtSocket
impl Sync for SrtSocket
impl Unpin for SrtSocket
impl UnsafeUnpin for SrtSocket
impl UnwindSafe for SrtSocket
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