nc (netcat): Connection refused problem

From my machine (ubuntu), I can do
$ nc somemachine 80

But, when I want to connect to other machine that runs nc on different ports, it throws "Connection refused" error.

The same error occurs on my local machine. For example,
[term 1] nc -l 5555
[term 2] nc x.x.x.x 5555 --> this throws "Connection refused" error (x.x.x.x is the ip number of the local machine)

It works on my ubuntu virtual machine though. So, I wonder what makes to throw out "Connection refused" error on nc.
Firewall? Network configuration? Anything else?
How can I make it work? On the same machine or across the machine?

Many thanks in advance.

The port option is -p, you are telling it to listen on the domain 5555 :slight_smile:

nc -p 5555 -l

Thanks. :wall: