I used netcat in the following way
nc -l 3333 //for server
nc 127.0.0.1 3333 // for client
With this I am able to use it as a two way chatting system.
My question is, then why is there another option
-p ( -p source_port Specifies the source port nc should use, subject to privilege restrictions and availability.)
It works with -p option too. What is the difference between the two?
A TCP connection consists of two TCP endpoints, each consisting of an IP address and a TCP port. The client usually chooses a random port, although you can force
netstat
to use a given port using the-p
option.Try: