- Set up the listening socket using the following command:
nc -l 1234
This will create a listening socket on port 1234 on the local machine.
- Connect to the socket using the following command:
nc HOST 1234
If you are running this on the same machine as the listening socket, replace HOST with localhost, otherwise replace it with the IP address or hostname of the machine.
- Type something and press Enter on the terminal where you performed step 2. The message will appear on the terminal where you performed step 1.