diff options
Diffstat (limited to 'examples/udp_async.rs')
| -rw-r--r-- | examples/udp_async.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/examples/udp_async.rs b/examples/udp_async.rs index 606b6cd..5fdc1ef 100644 --- a/examples/udp_async.rs +++ b/examples/udp_async.rs @@ -2,8 +2,7 @@ //! Use `nc -u 127.0.0.1 30000` to connect. use mini_rust_runtime::executor::Executor; -use mini_rust_runtime::udp::UdpSocket; -use tokio::io::{AsyncReadExt, AsyncWriteExt}; +use mini_rust_runtime::net::udp::UdpSocket; fn main() { let ex = Executor::new(); // 执行器实例 @@ -17,6 +16,7 @@ async fn server() { match socket.recv_from_async(&mut buf).await { Ok((n, addr)) => { println!("recv_from {} {} bytes", addr, n); + println!("Received data {:?}", &buf[..n]); if n == 0 || socket.send_to_async(&buf[..n], &addr).await.is_err() { // 回写 return; |
