diff options
Diffstat (limited to 'client/src/main.rs')
-rw-r--r-- | client/src/main.rs | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/client/src/main.rs b/client/src/main.rs index e1f556f..cfbd052 100644 --- a/client/src/main.rs +++ b/client/src/main.rs @@ -1,15 +1,20 @@ pub mod download; pub mod network; -pub mod scene_render; pub mod renderer; +pub mod scene_prepare; +pub mod scene_render; pub mod state; pub mod window; -pub mod scene_prepare; use anyhow::Result; use clap::Parser; use log::info; -use std::net::{SocketAddr, TcpStream}; +use rand::random; +use std::{ + io::Write, + net::{SocketAddr, TcpStream}, +}; +use weareshared::packets::{Packet, ReadWrite}; use window::WindowState; use winit::event_loop::EventLoop; @@ -23,7 +28,9 @@ fn main() -> Result<()> { let args = Args::parse(); info!("connecting..."); - let sock = TcpStream::connect(args.address)?; + let mut sock = TcpStream::connect(args.address)?; + Packet::Connect(random()).write(&mut sock)?; + sock.flush()?; info!("connection established"); let evloop = EventLoop::new()?; evloop.run_app(&mut WindowState::new(sock))?; |