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 trialSimon Banyard
Courses Plus Student 20,115 PointsConnection closed by foreign host...
Hi All,
I'm following along with the tutorial, but I'm not getting any response from the httpbin.org server. I'm connecting just fine, but both my local terminal and the console in workspaces are returning "Connection closed by foreign host.". I can connect to the site through a browser. Any ideas most welcome!
$ telnet httpbin.org 80 Trying 54.175.219.8... Connected to httpbin.org. Escape character is '^]'. GET /xml HTTP/1.1 Host: httpbin.org Connection closed by foreign host.
3 Answers
Tiger Wang
26,548 PointsHey Simon, I encountered the same problem, and I found after typing
GET / HTTP/1.1
Host: httpbin.org
You should press enter twice, I guess that telnet is waiting for you to give the rest of the request. BTW:Christ has been talking so fast :D .
Simon Banyard
Courses Plus Student 20,115 PointsNailed it!
Ramy Elsaraf
7,633 PointsHow do you type the second line without pressing enter, how do you get down ????
Jason Anders
Treehouse Moderator 145,860 PointsHey Simon,
The "connection closed by foreign host" will come up ~60 seconds after you open the connection if there is no action. This is normal and done by httpbin.org. I found it best to watch what Chris does completely then pause / rewind and follow along (with your new connection). If you don't, sometimes he explains what he is doing for longer than 60 seconds, and then you will lose the connection just as he types the commands.
Hope this helps.
Simon Banyard
Courses Plus Student 20,115 PointsThanks Jason. Sadly, I've been doing exactly that! Thanks for the advice. :)
Paul Seda
472 PointsSimon, did you go to a new line by pressing enter after typing HTTP/1.1?
Kyle Vassella
9,033 PointsI never figured out how to go to a new line in the workspace console. edit: Nevermind, it's option + enter on mac (probably alt + enter for windows)
coreycoding
12,481 Pointscoreycoding
12,481 PointsAfter a failed attempt I reset the console(work space) and completed the first action as mentioned, I then pasted the text below into the console and pressed return twice. Yah me! It worked. & Thanks Jason Anders.
GET / HTTP/1.1 Host: httpbin.org