Client-server using netcat.
Open two computer terminals:
The first will act as the server.
The second will be the client.
nc [-options] hostname port[s] [ports]
nc -l -p port [-options] [hostname] [port]
-l: set the “listen” mode, waits for the incoming connections.
-p: local port
-u: set the UDP mode
With Netcat your PC will act like server
you want to begin as a server that listens at port 8080:
$ nc -l 8080
In addition, we can use the server to connect to the port (8080) recently opened, from the client side:
$ nc localhost 8080