update
This commit is contained in:
parent
031b64c712
commit
11f6bbab94
@ -4,4 +4,6 @@ version = "0.1.0"
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
env_logger = "0.11.3"
|
||||||
|
log = "0.4.22"
|
||||||
tokio = { version = "1.38" , features = ["full"] }
|
tokio = { version = "1.38" , features = ["full"] }
|
||||||
|
23
src/main.rs
23
src/main.rs
@ -1,3 +1,22 @@
|
|||||||
fn main() {
|
use std::{error::Error};
|
||||||
println!("Hello, world!");
|
|
||||||
|
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(())
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user