After creating a TcpListener by binding it to a socket address, it listens
for incoming TCP connections. These can be accepted by calling accept or by
iterating over the Incoming iterator returned by incoming.

Implementations

Creates a new TcpListener which will be bound to the specified
address.

The returned listener is ready for accepting connections.

Binding with a port number of 0 will request that the OS assigns a port
to this listener. The port allocated can be queried via the
local_addr method.

The address type can be any implementor of ToSocketAddrs trait. See
its documentation for concrete examples.

If addr yields multiple addresses, bind will be attempted with
each of the addresses until one succeeds and returns the listener. If
none of the addresses succeed in creating a listener, the error returned
from the last attempt (the last address) is returned.

This will result in the accept operation becoming nonblocking,
i.e., immediately returning from their calls. If the IO operation is
successful, Ok is returned and no further action is required. If the
IO operation could not be completed and needs to be retried, an error
with kind io::ErrorKind::WouldBlock is returned.

On Unix platforms, calling this method corresponds to calling fcntlFIONBIO. On Windows calling this method corresponds to calling
ioctlsocketFIONBIO.