1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
use clap::{App, Arg}; use std::net::{SocketAddr, TcpListener}; fn main() { solana_logger::setup(); let matches = App::new("solana-ip-address-server") .version(solana_version::version!()) .arg( Arg::with_name("port") .index(1) .required(true) .help("TCP port to bind to"), ) .get_matches(); let port = matches.value_of("port").unwrap(); let port = port .parse() .unwrap_or_else(|_| panic!("Unable to parse {}", port)); let bind_addr = SocketAddr::from(([0, 0, 0, 0], port)); let tcp_listener = TcpListener::bind(bind_addr).expect("unable to start tcp listener"); let _runtime = solana_net_utils::ip_echo_server(tcp_listener); loop { std::thread::park(); } }