use lpc::types::{IpcExt, LpcExt};
use once_cell::sync::Lazy;
fn main() {
common_uu::log4rs_mod::init().unwrap();
let client = lpc::client::LpcClient::new("./Server_key", 1).unwrap();
client.recver(|_data, call| {
if let Some(call) = call {
call.response(b"1231gfdgdsgd45342312".to_vec()).unwrap();
}
static RECKON: once_cell::sync::Lazy<fast_able::statis::Statis> =
once_cell::sync::Lazy::new(|| {
fast_able::statis::Statis::new(|v| println!("client recver sum: {v}"))
});
RECKON.add();
});
loop {
if let Err(e) = client.send_res("1231fdertrrdgdfg2312") {
eprintln!("client.send: {e:?}");
std::thread::sleep(std::time::Duration::from_millis(1 * 1000));
continue;
}
static RECKON: once_cell::sync::Lazy<fast_able::statis::Statis> =
once_cell::sync::Lazy::new(|| {
fast_able::statis::Statis::new(|v| println!("client send(is_res: true) sum: {v}"))
});
RECKON.add();
}
}
pub static LPC_CLIENT: Lazy<lpc::client::LpcClient> = Lazy::new(|| {
lpc::client::LpcClient::new("./Server_key", 5).expect("Failed to start lpc server")
});