telnet
is a useful utility.
Its syntax is:
telnet host port
So for example:
telnet localhost 8000
This is useful because sometimes you want to look at the raw data being transmitted without a client interpreting it. For example:
$ python3 -m http.server
In another tab:
$ telnet localhost 8000
Trying ::1...
Connected to localhost.
Escape character is '^]'.
GET /
<!DOCTYPE HTML>
<html lang="en">
...
The python http.server one closes the telnet connection when it’s done.
If you want to close it yourself manually, use the escape character control-]
, which will put you at the telnet>
prompt. You can close that with close
:
telnet> close
Connection closed.
$
telnet towel.blinkenlights.nl
for an ascii star wars experience!