Initial commit: RAIDGuard X Rust/Slint GUI client and server

This commit is contained in:
accusys
2026-03-27 15:57:32 +08:00
commit 06e1cffae7
7 changed files with 7237 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
//! Simple test client
use std::io::{Read, Write};
use std::net::TcpStream;
fn main() {
println!("Connecting to 127.0.0.1:8923...");
match TcpStream::connect("127.0.0.1:8923") {
Ok(mut stream) => {
println!("Connected! Sending ping...");
let msg = r#"{"id":"test","type":"request","action":"ping","params":{}}"#;
stream.write_all(msg.as_bytes()).unwrap();
stream.write_all(b"\n").unwrap();
let mut buf = [0u8; 1024];
match stream.read(&mut buf) {
Ok(n) => {
let response = String::from_utf8_lossy(&buf[..n]);
println!("Response: {}", response);
}
Err(e) => println!("Read error: {}", e),
}
}
Err(e) => println!("Connection failed: {}", e),
}
}