safina-net

crates.io version license: Apache 2.0 unsafe forbidden pipeline status

This is a safe Rust library for network communication.

It is part of safina, a safe async runtime.

Features

Limitations

Examples

```rust let bindaddr = std::net::SocketAddr::from(([127, 0, 0, 1], 0)); let mut listener = safinanet::TcpListener::bind(&bindaddr) .unwrap(); let addr = listener.inner().localaddr().unwrap(); println!("{}", &addr);

let executor = safinaexecutor::Executor::default(); executor.spawn(async move { let mut tcpstream = safinanet::TcpStream::connect(addr) .await .unwrap(); let mut buf = String::new(); tcpstream.readtostring(&mut buf).await.unwrap(); println!("read {:?}", buf); });

let (mut tcpstream, _addr) = listener.accept().await.unwrap(); tcpstream.write_all(b"response").await.unwrap(); println!("wrote response"); ```

For complete examples, see the integration tests in tests/.

Alternatives

Changelog

Changelog

TO DO

License: Apache-2.0