EOF: End of file. 在linux万物皆file的情况下connection也可以是一个file。所以,当Connection关闭的时候,就会产生EOF。
stream.read_to_end()是持续read()直到EOF,因此能够读完网络里的数据,如果使用stream.read_to_end(&mut buf).await?;读取的话,会持续wait,直到连接关闭才能进行后续的操作。
A0.何文祥
2023-11-20来自广东
cargo new --bin getinf应为cargo new --bin getinfo
Andylinge
2023-11-20来自江苏
Windows 11 报如下错误,大家可以把process里面的获取时间命令自己用Rust重写一下。
```Listening on: 127.0.0.1:8880
Accepted a connection from: 127.0.0.1:9354
gettime
thread 'tokio-runtime-worker' panicked at src/server.rs:80:58:
called `Result::unwrap()` on an `Err` value: Error { kind: NotFound, message: "program not found" }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: process didn't exit successfully: `D:\00-Program\05-Rust\14-Rust_MikeTang\r14_tokio\getinfo\target\debug\server.exe` (exit code: 0xc000013a, STATUS_CONTROL_C_EXIT)
```