The following introduction is based on telnet, a program that is found in virtually all computer systems. It does not require root privileges and can be run on a virtual machine over a terminal.
Originally, telnet [host address] was used to remotely administrate servers over a network, but it was extremely insecure and has been replaced with ssh.
Nonetheless, telnet is useful for quickly setting up TCP connections and testing out certain services. To connect to port 80 to test a web server, use the following:
$ telnet syntaxionist.rogerhub.com 80
Output similar to the following will appear:
Trying 50.116.11.45...
Connected to syntaxionist.rogerhub.com.
Escape character is '^]'.
You have a couple of seconds to type responses back to the server. If you wait too long, the connection will be automatically closed.
Request a web page with by typing the following:
GET / HTTP/1.1
Host: syntaxionist.rogerhub.com
[press the return key]
[press the return key again]
You will get a page full of HTML, and depending on the server, the connection will either close or stay open for another request.
Additionally, you can test SMTP servers using:
$ telnet smtp.gmail.com 25
Then, enter the following commands:
helo example
mail from: Person
data
To: example@gmail.com
From: person@example.com
Subject: Greetings!
Hello there.[press the return key]
[press the return key again]
.[press the return key]
quit
You can read more about the SMTP and the HTTP protocols elsewhere.
These examples show that telnet is useful for testing simple connections when a full-blown web browser or email client is too troublesome to install and configure.