#[cfg(not(windows))]
fn main() {
eprintln!("This example is not available on platforms other than Windows.");
}
#[cfg(windows)]
fn main() -> std::io::Result<()> {
use {
interprocess::os::windows::named_pipe::*,
std::io::{prelude::*, BufReader},
};
let name = r"\\.\pipe\Example";
let mut buffer = String::with_capacity(128);
let mut conn = BufReader::new(DuplexPipeStream::<pipe_mode::Bytes>::connect_by_path(name)?);
conn.get_mut().write_all(b"Hello from client!\n")?;
conn.read_line(&mut buffer)?;
drop(conn);
print!("Server answered: {buffer}");
Ok(())
}