use interprocess::os::unix::udsocket::tokio::*;
use tokio::{
io::{AsyncReadExt, AsyncWriteExt},
try_join,
};
pub async fn main() -> anyhow::Result<()> {
let mut conn = UdStream::connect("/tmp/example.sock").await?;
let (mut reader, mut writer) = conn.split();
let mut buffer = String::with_capacity(128);
let write = async {
writer.write_all(b"Hello from client!\n").await?;
writer.shutdown()?;
Ok(())
};
let read = reader.read_to_string(&mut buffer);
try_join!(write, read)?;
drop(conn);
println!("Server answered: {}", buffer.trim());
Ok(())
}