doc.rust-lang.org
pub fn set_nodelay(&self, nodelay: bool) -> io::Result<()>
Sets the value of the TCP_NODELAY option on this socket.
method
std
Stable since 1.9.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn read_timeout(&self) -> io::Result<Option<Duration>>
Returns the read timeout of this socket.
method
std
Stable since 1.4.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn peer_addr(&self) -> io::Result<SocketAddr>
Returns the socket address of the remote peer of this TCP connection.
method
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn peek(&self, buf: &mut [u8]) -> io::Result<usize>
Receives data on the socket from the remote address to which it is connected, without removing that data from the queue. On success, returns the number of bytes peeked.
method
std
Stable since 1.18.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn nodelay(&self) -> io::Result<bool>
Gets the value of the TCP_NODELAY option on this socket.
method
std
Stable since 1.9.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn local_addr(&self) -> io::Result<SocketAddr>
Returns the socket address of the local half of this TCP connection.
method
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn connect_timeout(addr: &SocketAddr, timeout: Duration) -> io::Result<TcpStream>
Opens a TCP connection to a remote host with a timeout.
associated_function
std
Stable since 1.21.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn connect<A>(addr: A) -> io::Result<TcpStream>
Opens a TCP connection to a remote host.
associated_function
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub struct TcpStream
A TCP stream between a local and a remote socket.
struct
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn ttl(&self) -> io::Result<u32>
Gets the value of the IP_TTL option for this socket.
method
std
Stable since 1.9.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn try_clone(&self) -> io::Result<TcpListener>
Creates a new independently owned handle to the underlying socket.
method
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn take_error(&self) -> io::Result<Option<io::Error>>
Gets the value of the SO_ERROR option on this socket.
method
std
Stable since 1.9.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn set_ttl(&self, ttl: u32) -> io::Result<()>
Sets the value for the IP_TTL option on this socket.
method
std
Stable since 1.9.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn set_nonblocking(&self, nonblocking: bool) -> io::Result<()>
Moves this TCP stream into or out of nonblocking mode.
method
std
Stable since 1.9.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn local_addr(&self) -> io::Result<SocketAddr>
Returns the local socket address of this listener.
method
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn incoming(&self) -> Incoming<'_>
Returns an iterator over the connections being received on this listener.
method
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn bind<A>(addr: A) -> io::Result<TcpListener>
Creates a new TcpListener which will be bound to the specified address.
associated_function
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn accept(&self) -> io::Result<(TcpStream, SocketAddr)>
Accept a new incoming connection from this listener.
method
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub struct TcpListener
A TCP socket server, listening for connections.
struct
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub struct Incoming<'a>
An iterator that infinitely accepts connections on a TcpListener.
struct
std
Stable since 1.0.0
Version 1.100.0-nightly