This commit is contained in:
Zengtudor 2024-07-14 20:27:25 +08:00
parent 031b64c712
commit 11f6bbab94
2 changed files with 23 additions and 2 deletions

View File

@ -4,4 +4,6 @@ version = "0.1.0"
edition = "2021"
[dependencies]
env_logger = "0.11.3"
log = "0.4.22"
tokio = { version = "1.38" , features = ["full"] }

View File

@ -1,3 +1,22 @@
fn main() {
println!("Hello, world!");
use std::{error::Error};
use env_logger;
use log::{info};
use tokio::net::TcpListener;
const LOCAL_SERVER:&str = "127.0.0.1:8888";
#[tokio::main]
async fn main() ->Result<(),Box<dyn Error>> {
env_logger::init();
let listener: TcpListener = TcpListener::bind(LOCAL_SERVER).await?;
loop {
info!("The Server will be started ...");
let (socket,addr) = listener.accept().await?;
info!("{} connected",addr);
}
Ok(())
}