fn server() {
    let listener = TcpListener::bind("127.0.0.1:42069").expect("port in use");
    eprintln!("server started");

    // accept one connection, then terminate
    let (mut client, _) = listener.accept().unwrap();
    for i in 0..=std::u32::MAX {
        writeln!(client, "a = {}", i).unwrap();
        client.flush().unwrap();

        println!("server at {}", i);
        // sleep so the client has a chance to keep up with
        // the server and hopefully gets scheduled
        std::thread::sleep(std::time::Duration::from_millis(10));
    }
}
/// a TCP server that spews out `a = x` where x is counting up all u32's
/// (total transfered would be ~58GiB)
a TCP server that spews out `a = x` where x is counting up all u32's
(total transfered would be ~58GiB)
a TCP server that spews out ` a = x ` where x is counting up all u32 ' s ( total transfered would be ~58GiB )
fn server() {
    let listener = TcpListener::bind("127.0.0.1:42069").expect("port in use");
    eprintln!("server started");
    // accept one connection, then terminate
    let (mut client, _) = listener.accept().unwrap();
    for i in 0..=std::u32::MAX {
        writeln!(client, "a = {}", i).unwrap();
        client.flush().unwrap();
        println!("server at {}", i);
        // sleep so the client has a chance to keep up with
        // the server and hopefully gets scheduled
        std::thread::sleep(std::time::Duration::from_millis(10));
    }
}
fn server ( ) { let listener = TcpListener :: bind ( " " ) . expect ( " " ) ; eprintln ! ( " " ) ; // accept one connection, then terminate let ( mut client , _ ) = listener . accept ( ) . unwrap ( ) ; for i in 0 ..= std :: u32 :: MAX { writeln ! ( client " " i ) . unwrap ( ) ; client . flush ( ) . unwrap ( ) ; println ! ( " " i ) ; // sleep so the client has a chance to keep up with // the server and hopefully gets scheduled std :: thread :: sleep ( std :: time :: Duration :: from_millis ( 10 ) ) ; } }
a TCP server that spews out `a = x` where x is counting up all u32's
(total transfered would be ~58GiB)
a TCP server that spews out ` a = x ` where x is counting up all u32 ' s ( total transfered would be ~58GiB )