blob: cdd7c17fdf1c5fd20d9990203959c87956fb9bca (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
use lightyear::transport::io::TransportConfig;
use shared::SERVER_PORT;
use std::net::Ipv4Addr;
use std::net::SocketAddr;
use std::thread;
mod client;
mod protocol;
mod server;
mod shared;
fn main() {
let (from_server_send, from_server_recv) = crossbeam_channel::unbounded();
let (to_server_send, to_server_recv) = crossbeam_channel::unbounded();
thread::spawn(|| {
let server_addr = SocketAddr::new(Ipv4Addr::new(0, 0, 0, 0).into(), SERVER_PORT);
server::main(TransportConfig::Channels {
channels: [(server_addr, to_server_recv, from_server_send)].to_vec(),
});
});
client::main(TransportConfig::LocalChannel {
recv: from_server_recv,
send: to_server_send,
});
}
|