IronForce is a decentralized network, Degeon is a messenger built on it
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1.1 KiB

use std::net;
use ironforce::interfaces::ip::IPInterface;
use ironforce::interface::Interface;
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();
}