added basic working example

This commit is contained in:
Nickiel12 2021-12-18 17:44:32 -08:00
parent eb536e25ec
commit 6917e51400

View file

@ -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();
} }