church_controller_rust/src/main.rs

23 lines
551 B
Rust
Raw Normal View History

2021-12-18 17:44:32 -08:00
use std::sync::mpsc;
use modules::socket_handler::Socket;
2021-12-10 15:16:05 -08:00
mod tests;
mod modules;
2021-12-17 12:39:11 -08:00
2021-12-18 17:44:32 -08:00
const SERVER_ADDRESS: &str = "10.0.0.168:5000";
2021-12-10 15:16:05 -08:00
fn main() {
2021-12-18 17:44:32 -08:00
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();
2021-12-17 12:39:11 -08:00
}