Problem in Establishing the TCP Connection using tonic

I have encountered this error while trying to run a grpc-based microservice client:

Error: tonic::transport::Error(Transport, hyper::Error(Connect, ConnectError("tcp connect error", Os { code: 111, kind: ConnectionRefused, message: "Connection refused" })))

The command was:

cargo run --bin client

when a tcp connection is refused, either the destination port is not listening, or it's blocked by firewall.

make sure your server is listening at the correct tcp port, and no firewall rules to block incoming traffic for the port.