O'Reilly logo
  • Ivan Zderadicka thinks this is interesting:

use std::net::lookup_host;

From

Cover of Network Programming with Rust

Note

Depracated and and removed from latest nightly. Instead use ToSocketAddrs trait:

use std::net::ToSocketAddrs; use std::env;

fn main() { let host_name = env::args().nth(1).unwrap(); let addrs = (host_name.as_str(), 0).to_socket_addrs().unwrap(); for a in addrs { println!("{} = {}", host_name, a.ip()) } }