pub fn bind<A: ToSocketAddrs>(addr: A) -> Result<TcpListener> {
        let addr = addr
            .to_socket_addrs()
            .unwrap()
            .next()
            .ok_or_else(|| io::Error::new(io::ErrorKind::Other, "empty address"))?;

        let domain = if addr.is_ipv6() {
            Domain::ipv6()
        } else {
            Domain::ipv4()
        };
        let sk = Socket::new(domain, Type::stream(), Some(Protocol::tcp()))?;
        let addr = socket2::SockAddr::from(addr);
        sk.set_reuse_port(true)?;
        sk.bind(&addr)?;
        sk.listen(1024)?;
        let listener = sk.into_tcp_listener();

        Ok(TcpListener {
            reactor: Rc::downgrade(&crate::executor().reactor()),
            listener,
        })
    }
/// Creates a TCP listener bound to the specified address.
///
/// Binding with port number 0 will request an available port from the OS.
///
/// This method sets the ReusePort option in the bound socket, so it is
/// designed to be called from multiple executors to achieve
/// parallelism.
///
/// # Examples
///
/// ```
/// use glommio::{net::TcpListener, LocalExecutor};
///
/// let ex = LocalExecutor::default();
/// ex.run(async move {
///     let listener = TcpListener::bind("127.0.0.1:8000").unwrap();
///     println!("Listening on {}", listener.local_addr().unwrap());
/// });
/// ```
Creates a TCP listener bound to the specified address.
Binding with port number 0 will request an available port from the OS.

This method sets the ReusePort option in the bound socket, so it is
designed to be called from multiple executors to achieve
parallelism.
Creates a TCP listener bound to the specified address . Binding with port number 0 will request an available port from the OS . This method sets the ReusePort option in the bound socket so it is designed to be called from multiple executors to achieve parallelism .
pub fn bind<A: ToSocketAddrs>(addr: A) -> Result<TcpListener> {
        let addr = addr
            .to_socket_addrs()
            .unwrap()
            .next()
            .ok_or_else(|| io::Error::new(io::ErrorKind::Other, "empty address"))?;
        let domain = if addr.is_ipv6() {
            Domain::ipv6()
        } else {
            Domain::ipv4()
        };
        let sk = Socket::new(domain, Type::stream(), Some(Protocol::tcp()))?;
        let addr = socket2::SockAddr::from(addr);
        sk.set_reuse_port(true)?;
        sk.bind(&addr)?;
        sk.listen(1024)?;
        let listener = sk.into_tcp_listener();
        Ok(TcpListener {
            reactor: Rc::downgrade(&crate::executor().reactor()),
            listener,
        })
    }
pub fn bind < A : ToSocketAddrs > ( addr : A ) -> Result < TcpListener > { let addr = addr . to_socket_addrs ( ) . unwrap ( ) . next ( ) . ok_or_else ( | | io :: Error :: new ( io :: ErrorKind :: Other , " " ) ) ? ; let domain = if addr . is_ipv6 ( ) { Domain :: ipv6 ( ) } else { Domain :: ipv4 ( ) } ; let sk = Socket :: new ( domain , Type :: stream ( ) , Some ( Protocol :: tcp ( ) ) ) ? ; let addr = socket2 :: SockAddr :: from ( addr ) ; sk . set_reuse_port ( true ) ? ; sk . bind ( & addr ) ? ; sk . listen ( 1024 ) ? ; let listener = sk . into_tcp_listener ( ) ; Ok ( TcpListener { reactor : Rc :: downgrade ( & crate :: executor ( ) . reactor ( ) ) , listener , } ) }
Creates a TCP listener bound to the specified address.
Creates a TCP listener bound to the specified address .
addr
A
addr
A
examples
```
use glommio::{net::TcpListener, LocalExecutor}.

let ex = LocalExecutor::default();
ex.run(async move {
let listener = TcpListener::bind("127.0.0.1:8000").unwrap();
println!("Listening on {}", listener.local_addr().unwrap());
});
```
` ` ` use glommio :: { net :: TcpListener LocalExecutor } . let ex = LocalExecutor :: default () ; ex . run ( async move { let listener = TcpListener :: bind ( " 127 . 0 . 0 . 1 : 8000 " ) . unwrap () ; println! ( " Listening on {} " listener . local_addr () . unwrap () ) ; } ) ; ` ` `