pub struct TcpStream(/* private fields */);Expand description
A TCP stream between a local and a remote socket.
Implementations§
Source§impl TcpStream
impl TcpStream
Sourcepub fn connect(addr: SocketAddr, domain: SocketDomain) -> Result<Self>
pub fn connect(addr: SocketAddr, domain: SocketDomain) -> Result<Self>
Opens a TCP connection to a remote host.
Sourcepub fn read(&mut self, buf: &mut [u8]) -> Result<usize>
pub fn read(&mut self, buf: &mut [u8]) -> Result<usize>
Reads some bytes from the stream into the specified buffer.
Sourcepub fn accept_abs(&self, abstime: OsTime) -> Result<(TcpStream, SocketAddr)>
pub fn accept_abs(&self, abstime: OsTime) -> Result<(TcpStream, SocketAddr)>
Accepts a new connection with an absolute timeout.
Sourcepub fn connect_abs(
addr: SocketAddr,
domain: SocketDomain,
abstime: OsTime,
) -> Result<Self>
pub fn connect_abs( addr: SocketAddr, domain: SocketDomain, abstime: OsTime, ) -> Result<Self>
Opens a TCP connection to a remote host with an absolute timeout.
Sourcepub fn shutdown(&self, how: SocketShutdownMode) -> Result<()>
pub fn shutdown(&self, how: SocketShutdownMode) -> Result<()>
Gracefully shuts down the read, write, or both halves of the connection.
Trait Implementations§
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