-
Notifications
You must be signed in to change notification settings - Fork 3
Description
We currently talk about things like telnet, which are really ancient. A much better (and more flexible) approach would be to use nc (netcat).
We can use things like
nc 127.0.0.1 60606
to open a connection to the specified IP and port, and then anything we type goes to that service and whatever it returns comes back to us, making it perfect for testing the echo server.
We can also use file redirect to try things like binary files:
nc 127.0.0.1 60606 < test_image.jpg > /tmp/image.jpg
We can even use nc to "fake out" the server:
nc -l 127.0.0.1 60606
The -l says to listen on that specified port, so it's like a server. Anything that comes in is printed in the terminal, and anything we type in will go back to whoever is connected to this port. This can be used to test the client by confirming both that what's typed on the client appears on the server, and what's entered on the server appears on the client.