From bf6fd0e81a0ea2e7326ff02669d22ae27d3c482b Mon Sep 17 00:00:00 2001 From: Paul Date: Fri, 3 Jan 2025 22:59:55 +0100 Subject: [PATCH] split ADDR and PORT --- src/main.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 97f5247..08c62e3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -8,7 +8,8 @@ use std::io; use tokio::net::TcpListener; -const ADDR: &'static str = "0.0.0.0:7701"; +const ADDR: &'static str = "0.0.0.0"; +const PORT: u64 = 7701; const BUFSIZE: usize = 1024; #[tokio::main] @@ -29,7 +30,7 @@ fn test() { } async fn apiserver() -> io::Result<()> { - let listener = match TcpListener::bind(ADDR).await { + let listener = match TcpListener::bind(format!("{}:{}", ADDR, PORT)).await { Ok(o) => o, Err(e) => { println!("error: {e}");