3 changed files with 88 additions and 29 deletions
@ -0,0 +1,40 @@ |
|||||||
|
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();
|
||||||
|
} |
Loading…
Reference in new issue