Compare commits

..

5 Commits

Author SHA1 Message Date
kdeng00 f1375f5639 Update icarus_models (#15)
Reviewed-on: #15
Co-authored-by: kdeng00 <kundeng00@pm.me>
Co-committed-by: kdeng00 <kundeng00@pm.me>
2025-05-28 23:44:20 +00:00
kdeng00 b41933e05e Stamped rust version (#14)
Reviewed-on: #14
Co-authored-by: kdeng00 <kundeng00@pm.me>
Co-committed-by: kdeng00 <kundeng00@pm.me>
2025-05-28 23:28:28 +00:00
phoenix d1610d1331 service (#11)
Reviewed-on: #11
Co-authored-by: phoenix <kundeng94@gmail.com>
Co-committed-by: phoenix <kundeng94@gmail.com>
2025-04-12 17:28:03 +00:00
phoenix 8bc49e781b Correcting action workflow (#12)
Reviewed-on: #12
Co-authored-by: phoenix <kundeng94@gmail.com>
Co-committed-by: phoenix <kundeng94@gmail.com>
2025-04-05 22:00:41 +00:00
phoenix f68d01d50f Workflow changes (#9)
Reviewed-on: #9
Co-authored-by: phoenix <kundeng94@gmail.com>
Co-committed-by: phoenix <kundeng94@gmail.com>
2025-04-05 21:26:05 +00:00
2 changed files with 40 additions and 3 deletions
+3 -1
View File
@@ -2,6 +2,8 @@
name = "songparser"
version = "0.1.0"
edition = "2024"
rust-version = "1.86"
[dependencies]
icarus_models = { git = "ssh://git@git.kundeng.us/phoenix/icarus_models.git", tag = "v0.2.0" }
tokio = { version = "1.44.1", features = ["full"] }
icarus_models = { git = "ssh://git@git.kundeng.us/phoenix/icarus_models.git", tag = "v0.4.3" }
+37 -2
View File
@@ -1,3 +1,38 @@
fn main() {
println!("Hello, world!");
use std::error::Error;
use tokio::io::AsyncReadExt;
use tokio::net::{TcpListener, TcpStream};
use tokio::spawn;
#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
let listener = TcpListener::bind("127.0.0.1:8080").await?;
println!("API calling service listening on 127.0.0.1:8080");
loop {
let (stream, addr) = listener.accept().await?;
println!("Accepted connection from: {}", addr);
spawn(async move {
if let Err(e) = handle_connection(stream).await {
eprintln!("Error handling connection from {}: {}", addr, e);
}
});
}
}
async fn handle_connection(mut stream: TcpStream) -> Result<(), Box<dyn Error + Send + Sync>> {
let mut buffer = [0; 1024];
loop {
let n = stream.read(&mut buffer).await?;
if n == 0 {
break; // Connection closed
}
let request_data = String::from_utf8_lossy(&buffer[..n]).trim().to_string();
println!("Received request: {}", request_data);
}
Ok(())
}