TimonPost / laminar

A simple semi-reliable UDP protocol for multiplayer games
821 stars 66 forks source link

UDP example does nothing #273

Open TheRadioGuy opened 4 years ago

TheRadioGuy commented 4 years ago

Hey, I copied UDP example and added in main this:

 fn main() {
    send_data();
    receive_data();
} 

And it does nothing

image

CrabBucket commented 4 years ago

I am also having issues but your main is messed up first, you need to unwrap send_data() im fairly certain. Second you are sending the data then going into the recieve loop. Regardless nothing is happening in this main either by running it as a server then running the client:

fn main() {
    let mut is_server = false;
    if arg_count() > 2 {
        println!("Invalid number of arguments max number of arguments allowed is 2");
        std::process::exit(0);
    }
    for flag in get_flags() {
        match flag.flag_type {
            FlagType::Server => {
                is_server = true;
            }
            _ => {

            }   
        }
    }
    if is_server {
        receive_data();
        std::process::exit(0);
    }
    send_data().unwrap();

}