TcpListener fails to bind?

I have the following (simplified) code:

use tokio::net::TcpListener;

async fn main() {
    let listener = TcpLIstener::bind("").await.unwrap();
    loop {
         let (stream, _) = listener.accept().await.unwrap();
         // Now process the data

This code runs without problem. But the thing is that I cannot connect to this server. And even worse ss -ta doesn't show anything on this port.
What might the problem be?

One of the first tools I reach for is nmap whenever I'm having issues connecting to a particular port. You would do something like nmap and it'll scan that computer to see which ports are open.

If you can ping the machine but are unable to connect to that specific port, chances are your firewall rules are blocking things.

1 Like

Is there any reason you put as the IP in the bind call? I would try with instead.


This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.