Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Development Tools HTTP Basics Introduction to HTTP HTTP Requests Using Telnet

Why use telnet instead of raw TCP?

Sysadmin/networking guides typically recommend netcat/ncat/socat or TCP device over telnet.

  • Telnet is not raw TCP: it does some character handling and can garble data.
  • Telnet clients are no longer included with modern OSs.
  • According to video, telnet input has a time constraint?
  • Telnet is for terminal sessions, not actually meant for raw communication.

In contrast

  • The recommended commands send data unaltered.
  • ncat is available on POSIX and Windows.
  • No additional time constraint.
  • General purpose network diagnostics: actually meant for raw communication.

equivalent bash script for TCP device

#!/bin/bash
{
    sed -e 's/$/\r/' <<EOF >&3
GET $uri HTTP/1.1
Host: $domain

EOF
    cat <&3
} 3<>/dev/tcp/$domain/http

equivalent netcat

nc -C $domain http <<EOF
GET $uri HTTP/1.1
Host: $domain

EOF