pub fn resolve_ip(ip: Ipv4Addr) -> io::Result<Xbox> {
    let mut buf = [0; MAX_PACKET_LENGTH];
    buf[0] = 3;
    buf[1] = 0;
    let timeout = Some(Duration::from_millis(RESOLVE_TIMEOUT_MILLIS));
    let socket = UdpSocket::bind((Ipv4Addr::new(0, 0, 0, 0), 0))?;
    socket.set_read_timeout(timeout)?;
    socket.set_write_timeout(timeout)?;
    socket.send_to(&buf[..2], (ip, PORT_360))?;
    socket.send_to(&buf[..2], (ip, PORT_CLASSIC))?;
    loop {
        let (n, src) = match socket.recv_from(&mut buf) {
            Ok(x) => x,
            Err(ref e) if e.kind() == io::ErrorKind::Interrupted => continue,
            Err(e) => return Err(e),
        };
        if let Some(xbox) = parse_reply(&buf[..n], src) {
            if xbox.ip == ip {
                return Ok(xbox);
            }
        }
    }
}
/// Resolve the IP address specified by `ip` as an `Xbox` instance.
Resolve the IP address specified by `ip` as an `Xbox` instance.
Resolve the IP address specified by ` ip ` as an ` Xbox ` instance .
pub fn resolve_ip(ip: Ipv4Addr) -> io::Result<Xbox> {
    let mut buf = [0; MAX_PACKET_LENGTH];
    buf[0] = 3;
    buf[1] = 0;
    let timeout = Some(Duration::from_millis(RESOLVE_TIMEOUT_MILLIS));
    let socket = UdpSocket::bind((Ipv4Addr::new(0, 0, 0, 0), 0))?;
    socket.set_read_timeout(timeout)?;
    socket.set_write_timeout(timeout)?;
    socket.send_to(&buf[..2], (ip, PORT_360))?;
    socket.send_to(&buf[..2], (ip, PORT_CLASSIC))?;
    loop {
        let (n, src) = match socket.recv_from(&mut buf) {
            Ok(x) => x,
            Err(ref e) if e.kind() == io::ErrorKind::Interrupted => continue,
            Err(e) => return Err(e),
        };
        if let Some(xbox) = parse_reply(&buf[..n], src) {
            if xbox.ip == ip {
                return Ok(xbox);
            }
        }
    }
}
pub fn resolve_ip ( ip : Ipv4Addr ) -> io :: Result < Xbox > { let mut buf = [ 0 ; MAX_PACKET_LENGTH ] ; buf [ 0 ] = 3 ; buf [ 1 ] = 0 ; let timeout = Some ( Duration :: from_millis ( RESOLVE_TIMEOUT_MILLIS ) ) ; let socket = UdpSocket :: bind ( ( Ipv4Addr :: new ( 0 , 0 , 0 , 0 ) , 0 ) ) ? ; socket . set_read_timeout ( timeout ) ? ; socket . set_write_timeout ( timeout ) ? ; socket . send_to ( & buf [ .. 2 ] , ( ip , PORT_360 ) ) ? ; socket . send_to ( & buf [ .. 2 ] , ( ip , PORT_CLASSIC ) ) ? ; loop { let ( n , src ) = match socket . recv_from ( & mut buf ) { Ok ( x ) => x , Err ( ref e ) if e . kind ( ) == io :: ErrorKind :: Interrupted => continue , Err ( e ) => return Err ( e ) , } ; if let Some ( xbox ) = parse_reply ( & buf [ .. n ] , src ) { if xbox . ip == ip { return Ok ( xbox ) ; } } } }
Resolve the IP address specified by `ip` as an `Xbox` instance.
Resolve the IP address specified by ` ip ` as an ` Xbox ` instance .
ip
Ipv4Addr