fix listen bound ip

This commit is contained in:
nora 2022-02-05 18:30:46 +01:00 committed by GitHub
parent d9a17a6464
commit 9cbbaca88a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -9,7 +9,7 @@ type StreamResult = Result<TcpStream, Box<dyn Error>>;
pub fn listen() -> StreamResult {
println!("Listening on {}:8080", local_ipaddress::get().unwrap());
let listener = TcpListener::bind(("127.0.0.1", 8080))?;
let listener = TcpListener::bind(("0.0.0.0", 8080))?;
let stream = listener.incoming().next().unwrap()?;
println!("Connected.");
println!("other adress: {}", stream.peer_addr()?.ip());