nginx expects a datagram socket, not a stream socket. you can create a datagram socket like this:
use std::os::unix::net::UnixDatagram;
fn main() -> std::io::Result<()> {
let socket_path = format!(
"{}/logtool.sock",
std::env::var("XDG_RUNTIME_DIR").unwrap_or("/tmp".to_string())
);
let _ = std::fs::remove_file(&socket_path);
let listener = UnixDatagram::bind(socket_path)?;
loop {
let mut buf = vec![0; 1_024];
let read = listener.recv(&mut buf)?;
let buf = &buf[..read];
dbg!(buf);
}
}