Closed
Description
Based on this question, it appears that there is some issue with the incoming
stream on TcpListener
.
use async_std::net::TcpListener;
use futures::StreamExt;
#[async_std::main]
async fn main() {
let listener = TcpListener::bind("127.0.0.1:4444").await.unwrap();
println!("Server listening on {}", listener.local_addr().unwrap());
listener
.incoming()
.for_each(|tcpstream| async move {
let tcpstream = tcpstream.unwrap();
println!("Accepting from: {}", tcpstream.peer_addr().unwrap());
})
.await;
}
[dependencies]
async-std = { version = "=1.6.4", features = ["attributes"] }
futures = "0.3"
This example does not print anything when new connections are made to that TcpListener
, e.g. with nc 127.0.0.1 4444
. My guess is that it is somehow failing to send notifications to the waker.
It works when fine rewritten to use accept
in a loop.
Metadata
Metadata
Assignees
Labels
No labels