#[cfg(feature = "std")] use ironforce::interface::Interface; #[cfg(feature = "std")] use ironforce::interfaces::ip::IPInterface; #[cfg(feature = "std")] use std::net; #[cfg(feature = "std")] fn main() { let mut listener = match net::TcpListener::bind("0.0.0.0:60000") { Ok(tmp) => tmp, Err(_) => { return; } }; let mut interface1 = IPInterface { id: String::from("IP interface"), connections: vec![], listener, }; let option_listener = net::TcpListener::bind("0.0.0.0:50000"); let mut listener = match option_listener { Ok(tmp) => tmp, Err(_) => { return; } }; let mut interface2 = IPInterface { id: String::from("IP interface"), connections: vec![], listener, }; let t1 = std::thread::spawn(move || { interface1.send(&[0, 0, 1, 1], Some(String::from("0.0.0.0:50000"))); interface1 }); let t2 = std::thread::spawn(move || { interface2.main_loop_iteration(); interface2 }); let res1 = t1.join(); match res1 { Ok(_) => println!("Ok"), Err(e) => println!("{:?}", e), } let res2 = t2.join(); match res2 { Ok(_) => println!("Ok"), Err(e) => println!("{:?}", e), } // res1.unwrap(); } #[cfg(not(feature = "std"))] fn main() {}