pub struct TcpStream { /* private fields */ }Expand description
Async TCP stream. Implements AsyncRead + AsyncWrite.
Implementations§
Source§impl TcpStream
impl TcpStream
Sourcepub fn connect(addr: SocketAddr) -> ConnectFuture ⓘ
pub fn connect(addr: SocketAddr) -> ConnectFuture ⓘ
Connect to addr asynchronously.
Creates a non-blocking socket and starts a connect() call. Returns a
ConnectFuture that resolves once the TCP handshake completes.
Sourcepub fn peer_addr(&self) -> Result<SocketAddr>
pub fn peer_addr(&self) -> Result<SocketAddr>
Return the peer address of the connection.
Sourcepub fn local_addr(&self) -> Result<SocketAddr>
pub fn local_addr(&self) -> Result<SocketAddr>
Return the local address of the connection.
Trait Implementations§
Source§impl AsyncWrite for TcpStream
impl AsyncWrite for TcpStream
Auto Trait Implementations§
impl !Freeze for TcpStream
impl RefUnwindSafe for TcpStream
impl Send for TcpStream
impl Sync for TcpStream
impl Unpin for TcpStream
impl UnsafeUnpin for TcpStream
impl UnwindSafe for TcpStream
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