//! This example demonstrates how simple inter-process single instancing with data transfer is const INTERFACE: ssilide::Interface = ssilide::Interface::new(43615); fn main() -> std::io::Result<()> { let claim = match INTERFACE.claim() { Ok(claim) => claim, Err(error) => { if error.kind() == std::io::ErrorKind::AddrInUse { let client = INTERFACE.connect()?; client.send(&[1, 2, 3])?; return Ok(()); } else { return Err(error); } } }; // Make sure your message fits into your maximum datagram size let mut buf = [0; 1500]; loop { let amt = claim.recv(&mut buf)?; println!("received {amt} bytes: {:?}", &buf[..amt]); buf.fill(0); } }