Struct std::net::TcpListener
Re-export from std::net::unix::TcpListener
A TCP listener which can accept new connections.
Fields
-
socket: Socket
Methods
impl TcpListener { ... }
-
fn from_socket(socket: Socket) -> TcpListener
Create a new TCP listener from a socket.
-
fn bind(addr: &SocketAddr) -> Result<TcpListener>
Creates a new TCP listener bound to the specified address.
-
fn as_fd(self: &TcpListener) -> FileDescriptor
-
fn accept(self: &TcpListener) -> Result<(TcpStream, SocketAddr)>
Accepts a new incoming connection.
Returns a new
TcpStream
representing the accepted connection and the address of the remote peer. -
fn socket_addr(self: &TcpListener) -> Result<SocketAddr>
Returns the address of the remote peer
-
fn close(self: &mut TcpListener) -> Result<()>
Closes the socket.
-
fn move(self: &mut TcpListener) -> TcpStream