What is telnet?

Telnet is a command-line tool two computers or devices use to communicate with each other on the internet. Before there were graphical user interfaces like a web browser there was Telnet.

Our first Telnet Command.

When we open our Terminal on Mac we invoke Telnet by typing a command like this at the prompt:

telnet httpbin.org 80

-“telnet” is the command that starts the communication with another PC. Think of it as hand knocking on a door.

The other PC is located at the web address  “httpbin.org. *also called the URI (uniform resource identifier).

“80” is the port or the door to the other computer.

After we hit enter we get a response from the other computer.

“Escape character is ‘^]’.”

and a blank line to start typing our next request on the host site.

The other computer is telling us when we want to leave or close the door just type”Escape character is ‘^]’.” and will go back to our local Command Prompt.

 

Next. At the prompt we type.

GET / HTTP/1.1

Host: httpbin.org

Let’s examine this telnet command.

“GET” is the command we use to request or fetch content or data from a site.

The “/” is the document root is the location we want to fetch the content from.

“HTTP/1.1” is the version of HTTP we are using to translate the content to our terminal screen.

We type “Host: httpbin.org” to ensure we get the right website in the event  it is located on a shared server with multiple sites.

More Practice I

telnet httpbin.org 80

GET /xml HTTP/1.1

host: httpbin.org

enter twice

*be sure to press enter twice to execute the command.

We see that XML content is return.

XML stands for extensible markup language.

In summary a telnet request consists of a Request Line and A Header and Request Body.

2017-01-26_04-21-56

2017-01-26_04-28-12

2017-01-26_04-32-03

Request body is only used for Post requests which is optional.

CONTACT US

We're not around right now. But you can send us an email and we'll get back to you, asap.

Sending

©2020 RussellCoder

Log in with your credentials

or    

Forgot your details?

Create Account