✔️ TCP and UDP connections to a host from a client

✔️ connection involves a client and server

→ they can be on same or different computer

🟥 Server or listener:

$ nc -lvp 8888

🟦 Client connect to server

$ nc -v <address> <port to connect>

🟦 Input as file or text (client)

$ echo "hello" | nc -v <address> <port to connect>
$ cat sending.txt | nc -v <address> <port to connect>

🟥 Output redirection (server)

$ nc -lvp 8888 > recieved.txt

⭐ To execute commands on remote server

🟥 server

$ nc -lvp <port> -e /bin/bash

🟦 client

$ nc -v <address> <port to connect>