A zero-dependency, cross-platform async networking runtime built with Rust's uncompromising performance and safety.
A completely self-contained runtime, eliminating external library complexities and potential version conflicts.
async fn main() -> Result<()> {
let server = zsync::TcpListener::bind("0.0.0.0:8080").await?;
while let Ok((mut socket, _)) = server.accept().await {
tokio::spawn(async move {
let mut buf = [0; 1024];
while let Ok(n) = socket.read(&mut buf).await {
socket.write_all(&buf[..n]).await?;
}
});
}
Ok(())
}