pub struct TcpChannel { /* private fields */ }Expand description
A TCP socket
Implementations§
Source§impl TcpChannel
impl TcpChannel
Sourcepub fn new(runtime: Arc<dyn Runtime>, stream: Box<dyn AsyncTcpStream>) -> Self
pub fn new(runtime: Arc<dyn Runtime>, stream: Box<dyn AsyncTcpStream>) -> Self
Create a TCP socket from an existing TcpStream
Sourcepub async fn send_to(
&mut self,
data: &[u8],
to: SocketAddr,
) -> Result<(), Error>
pub async fn send_to( &mut self, data: &[u8], to: SocketAddr, ) -> Result<(), Error>
Send data to the specified address
Sourcepub fn recv(&mut self) -> impl Stream<Item = (Vec<u8>, SocketAddr)> + '_
pub fn recv(&mut self) -> impl Stream<Item = (Vec<u8>, SocketAddr)> + '_
Return a stream of received data blocks
Sourcepub fn local_addr(&self) -> Result<SocketAddr, Error>
pub fn local_addr(&self) -> Result<SocketAddr, Error>
The local address of the socket
Sourcepub fn remote_addr(&self) -> Result<SocketAddr, Error>
pub fn remote_addr(&self) -> Result<SocketAddr, Error>
The remoted address of the connected socket
Trait Implementations§
Source§impl Clone for TcpChannel
impl Clone for TcpChannel
Source§fn clone(&self) -> TcpChannel
fn clone(&self) -> TcpChannel
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for TcpChannel
impl !RefUnwindSafe for TcpChannel
impl Send for TcpChannel
impl Sync for TcpChannel
impl Unpin for TcpChannel
impl UnsafeUnpin for TcpChannel
impl !UnwindSafe for TcpChannel
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