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

Kyle Jensen
PLUS
Kyle Jensen
Courses Plus Student 6,293 Points

Can't connect with telnet

I've installed telnet on my local machine. When I go to connect to httpbin.org I get one of two messages.

HTTP/1.1 400 Bad Request Connection: close Server: Cowboy Date: Sun, 14 May 2017 17:37:00 GMT Content-Length: 0

Connection to host lost.

Press any key to continue...

OR-----

a cannot connect message

on windows 10 it looks like this

Microsoft Telnet> from there I have to type the letter o Microsoft Telnet> o then the screen looks like this Microsoft Telnet> o ( to ) now I can type in where I want to connect to Microsoft Telnet> o ( to ) httpbin.org 80

this leads to two minutes of

Connecting To httpbin.org.....

which is generally followed by

Press any key to continue...

then the above messages

I've searched the internet for about 2 hours and can't find anything to help me. I've attempted adding telnet to the acceptable list of apps to have access to the firewall. I've tried running it in powershell and powershell admin. I'm at a loss...Can someone please help me!?

I should also note that I tried in workspaces too. I cannot GET/HTTP/1.1 it returns bash: I cannot GET/HTTP/1.1 : No such file or directory

Could you write your whole command? Maybe you are requesting the data wrong?

Kyle Jensen
Kyle Jensen
Courses Plus Student 6,293 Points

Nejc Vukovic

Microsoft Telnet> o

( to ) httpbin.org 80

( to ) is written by the telnet application after I type the letter 'o' then I follow that by typing httpbin.org 80

'o' is a command in mine I tried typing telnet httpbin.org 80 but that is invalid so I typed 'h' for help which gives me a menu. the menu is as follows(partial)

c - close close current connection

d - display display operating parameters

o - open hostname [port] connect to hostname (default port 23).

2 Answers

How about simply:

telnet httpbin.org 80

Did you enable telnet like this: https://www.rootusers.com/how-to-enable-the-telnet-client-in-windows-10/ ?

Kyle Jensen
Kyle Jensen
Courses Plus Student 6,293 Points

It is enabled. And yeah, like I said I tried typing just that and it's invalid. I cannot even connect on workspaces now. I tried and got it once, but when I typed the GET command it said it was invalid. I tried reconnecting there and it tells me I was disconnected by some outside source. Did you happen to take the asp.net course? Can I skip ahead for now and come back to this without losing out?

Sure you can skip this. This is just to get you a bit familiar with the HTTP requests and the headers.

When using ASP.NET you don't use telnet but you utilise ASP HTTP calls in your apps. This course is to get you familiar with the tech if you want. I never took that course - just recently but I already knew how all of this works. And I never used Telnet before - maybe for a few connections, but none were API based.

Kyle Jensen
Kyle Jensen
Courses Plus Student 6,293 Points

Ok, I guess I will just watch the videos and write everything down. I'm not familiar with this at all, so I guess it would be good just to have heard/written the info on it. I tried getting on again to do the GET request, but still no luck on any of them(telnet/workspaces/PowerShell/console/PowerShell admin). I did find on PowerShell that I can type 'telnet httpbin.org 80' but I either get a timeout or can't connect. I'm starting to think the server is down. Thank you for trying. If I come up with a solution at any point, I will post it here.

Welcome.

I used my telnet and I can normally connect to the API. Windows quirks maybe :D

Just writing it down is OK. In the implementations the whole ordeal looks completely different.

Regards.

Nejc