Recenly I have started to learn network programming. I have written simple server programm
fn main() {
println!("Start server");
let server = TcpListener::bind("0.0.0.0:7878").unwrap();
match server.accept() {
Ok((_socket, addr)) => {
println!("new client: {:?}", addr);
loop {
//do something
}
}
Err(e) => { println!("couldn't accept the client: {:?}", e) }
}
println!("server disconnect")
}
and now I want run it in docker container and make it accessible from internet. what I mean is when I run docker container I want to connect to the tcp listener from another computer.
After running docker container I try to connect to that port using my public ip address. But I always get Timeout error
to run container I use docker run --rm -dp 7878:7878 appname
when I connect to that port using localhost everythign works fine