I try a very basic example of async_std. I probably do something wrong. Any help is welcome.
The code i am trying to do is:
let listener = TcpListener::bind("127.0.0.1:4444").await.unwrap();
println!("Server listening on {}", listener.local_addr().unwrap());
listener
.incoming()
.for_each_concurrent(None, |tcpstream| async move {
let tcpstream = tcpstream.unwrap();
println!("Accepting from: {}", tcpstream.peer_addr().unwrap());
})
.await;
It compile well.
When i start this TCP listener, and connect to it:
nc 127.0.0.1 4444
I expect the ip:port to be prompted thanks to the println!
But there is nothing, like the code execute.
But i verify with wireshark that the TCP server responds to the nc connection.
So there is definitely something that goes wrong.
Thanks for raising this! A report was filed in async-std#888 and we've published async-std@1.6.5 with a fix.
The root cause of this issue was that one of our dependencies (async-io) published a new version earlier today that included a change in Drop behavior. On its own it was a perfectly reasonable change, but it ended up affecting our implementation causing a regression. But we've managed to resolve this now!