From 44ef37bca0aa633f8c59d849946faf2319c5446b Mon Sep 17 00:00:00 2001 From: metamuffin Date: Mon, 6 Jan 2025 20:04:29 +0100 Subject: a --- client/src/main.rs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'client/src/main.rs') 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))?; -- cgit v1.2.3-70-g09d2