pub fn bind_common(port: u16, reuseaddr: bool) -> io::Result<(UdpSocket, TcpListener)> {
    let sock = udp_socket(reuseaddr)?;

    let addr = SocketAddr::new(IpAddr::V4(Ipv4Addr::new(0, 0, 0, 0)), port);
    let sock_addr = SockAddr::from(addr);
    match sock.bind(&sock_addr) {
        Ok(_) => match TcpListener::bind(&addr) {
            Ok(listener) => Result::Ok((sock.into_udp_socket(), listener)),
            Err(err) => Err(err),
        },
        Err(err) => Err(err),
    }
}
// binds both a UdpSocket and a TcpListener
binds both a UdpSocket and a TcpListener
binds both a UdpSocket and a TcpListener
pub fn bind_common(port: u16, reuseaddr: bool) -> io::Result<(UdpSocket, TcpListener)> {
    let sock = udp_socket(reuseaddr)?;
    let addr = SocketAddr::new(IpAddr::V4(Ipv4Addr::new(0, 0, 0, 0)), port);
    let sock_addr = SockAddr::from(addr);
    match sock.bind(&sock_addr) {
        Ok(_) => match TcpListener::bind(&addr) {
            Ok(listener) => Result::Ok((sock.into_udp_socket(), listener)),
            Err(err) => Err(err),
        },
        Err(err) => Err(err),
    }
}
pub fn bind_common ( port : u16 , reuseaddr : bool ) -> io :: Result < ( UdpSocket , TcpListener ) > { let sock = udp_socket ( reuseaddr ) ? ; let addr = SocketAddr :: new ( IpAddr :: V4 ( Ipv4Addr :: new ( 0 , 0 , 0 , 0 ) ) , port ) ; let sock_addr = SockAddr :: from ( addr ) ; match sock . bind ( & sock_addr ) { Ok ( _ ) => match TcpListener :: bind ( & addr ) { Ok ( listener ) => Result :: Ok ( ( sock . into_udp_socket ( ) , listener ) ) , Err ( err ) => Err ( err ) , } , Err ( err ) => Err ( err ) , } }
binds both a UdpSocket and a TcpListener
binds both a UdpSocket and a TcpListener
port
u16
reuseaddr
bool
port
u16
reuseaddr
bool