rust实践-异步并发socket通信
客户端
[package]
name = "rust_client"
version = "0.1.0"
edition = "2021"[dependencies]
tokio = { version = "1.14.0", features = ["full"] }
use tokio::io::{self, AsyncReadExt, AsyncWriteExt};
use tokio::net::TcpStream;#[tokio::main]
async fn main() -> io::Result<()> {let mut stream = TcpStream::connect("127.0.0.1:7878").await?;let (mut rd, mut wr) = stream.split();let mut buf = vec![0; 1024];loop {let n = match rd.read(&am