added basic working example
This commit is contained in:
parent
eb536e25ec
commit
6917e51400
1 changed files with 14 additions and 2 deletions
16
src/main.rs
16
src/main.rs
|
@ -1,10 +1,22 @@
|
||||||
|
use std::sync::mpsc;
|
||||||
|
|
||||||
|
use modules::socket_handler::Socket;
|
||||||
|
|
||||||
mod tests;
|
mod tests;
|
||||||
mod modules;
|
mod modules;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const SERVER_ADDRESS: &str = "localhost:5000";
|
const SERVER_ADDRESS: &str = "10.0.0.168:5000";
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
println!("hello world");
|
let socket_listener = Socket::make_listener(SERVER_ADDRESS);
|
||||||
|
let (from_socket_tx, from_socket_rx) = mpsc::channel::<String>();
|
||||||
|
let (mut listener_flag, listener_join_handle) = Socket::handle_connections(socket_listener, from_socket_tx);
|
||||||
|
|
||||||
|
let message = from_socket_rx.recv().unwrap();
|
||||||
|
println!("{}", message);
|
||||||
|
|
||||||
|
listener_flag.set(false);
|
||||||
|
listener_join_handle.join().unwrap();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue