/// Handles client connections if a game was found.
///
/// Sends the client the port of the game.
///
/// Client should then connect to the new port.
Handles client connections if a game was found.
Sends the client the port of the game.

Client should then connect to the new port.
Handles client connections if a game was found . Sends the client the port of the game . Client should then connect to the new port .
fn handle_client_connection(mut stream: TcpStream, port: i32) -> Result<(), Error> {
        println!("Incoming connection from: {}", stream.peer_addr()?);
        let mut buf = [0; 512];
        loop {
            let bytes_read = stream.read(&mut buf)?;
            if bytes_read == 0 {
                return Ok(());
            }
            let port: String = format!("{}\n", port);
            stream.write(port.as_bytes()).unwrap();
            stream.flush().unwrap();
        }
    }
fn handle_client_connection ( mut stream : TcpStream , port : i32 ) -> Result < ( ) , Error > { println ! ( " " stream peer_addr ( ) ) ; let mut buf = [ 0 ; 512 ] ; loop { let bytes_read = stream . read ( & mut buf ) ? ; if bytes_read == 0 { return Ok ( ( ) ) ; } let port : String = format ! ( " \n " port ) ; stream . write ( port . as_bytes ( ) ) . unwrap ( ) ; stream . flush ( ) . unwrap ( ) ; } }
Handles client connections if a game was found.
Handles client connections if a game was found .
stream
TcpStream
port
i32