Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

[noob] Connecting to a server using telnet

Options
  • 18-04-2012 4:35pm
    #1
    Registered Users Posts: 7,110 ✭✭✭


    I started the Web Applications course today on udacity.com. It's quite interesting however I had a problem with one of the exercises that required me to install telnet (I'm using Windows 7).

    After installation I tried to connect within the telnet window to the host using the command:

    o www.udacity.com 80

    and I get a message saying "connecting to www.udacity.com..." which sounds good but unfortunately it stays there forever.
    If I try other port numbers (or no port number at all) I get error messages saying that I can't connnect.

    Am I doing something wrong here or is this likely to be an issue with the server. (Do I have to wait for it to be vacant or something?)

    Also I can't run telnet from the command prompt as windows won't recognise the telnet command. Is this something to do with my environmental variables?


Comments

  • Registered Users Posts: 7,157 ✭✭✭srsly78


    Telnet is not secure, you should be using ssh instead.

    Annnnyway, try something like "o 1.2.3.4:80" instead.

    Install a proper client like putty: http://www.chiark.greenend.org.uk/~sgtatham/putty/


  • Closed Accounts Posts: 18,966 ✭✭✭✭syklops


    Works ok for me.

    I don't know what telnet client you downloaded, but can I recommend ncat instead. It is very powerful.


  • Registered Users Posts: 7,110 ✭✭✭Brussels Sprout


    syklops wrote: »
    Works ok for me.

    I don't know what telnet client you downloaded, but can I recommend ncat instead. It is very powerful.

    I was directed to go into the Control Panel/Programs menu and then into the "Turn Windows features on or off" menu. From there I checked the box next to Telnet Client and hit ok to install it.


  • Closed Accounts Posts: 18,966 ✭✭✭✭syklops


    srsly78 wrote: »
    Telnet is not secure, you should be using ssh instead.

    Annnnyway, try something like "o 1.2.3.4:80" instead.

    Install a proper client like putty: http://www.chiark.greenend.org.uk/~sgtatham/putty/

    well he is using port 80, which is HTTP so its as secure as any HTTP website would be. If you try to ssh to a webserver on port 80 it wont work.

    OP, it could maybe be a firewall blocking it. If it sees the executable telnet, and goes "oooh, bad telnet", it might be blocking it, despite the fact you just want to use it to talk HTTP to a web server


  • Registered Users Posts: 2,022 ✭✭✭Colonel Panic


    syklops wrote: »
    well he is using port 80, which is HTTP so its as secure as any HTTP website would be. If you try to ssh to a webserver on port 80 it wont work.

    OP, it could maybe be a firewall blocking it. If it sees the executable telnet, and goes "oooh, bad telnet", it might be blocking it, despite the fact you just want to use it to talk HTTP to a web server

    At least someone read the original post! :D


  • Advertisement
  • Registered Users Posts: 7,110 ✭✭✭Brussels Sprout


    srsly78 wrote: »
    Annnnyway, try something like "o 1.2.3.4:80" instead.

    I tried

    o 1.2.3.4:80

    Could not open connection to host on port 23, Connect failed

    o.1.2.3.4 :80

    Could not open connection to host on port :80, Connect failed

    o.1.2.3.4 80

    Connecting To 1.2.3.4.... (but nothing else happens-it neither fails nor connects)


  • Registered Users Posts: 2,149 ✭✭✭dazberry


    The issue is you are connecting to port 80 (HTTP), I'd bet it is connecting fine, but nothing is being echoed back and the server is waiting for you to issue a HTTP request. Try it again and type something and press return and see what happens...

    D.


  • Registered Users Posts: 2,022 ✭✭✭Colonel Panic


    That's just an example IP address he provided.

    The IP address it maps to is 209.85.142.121 but for reasons I won't go in to, that might not work because many hosts might be sharing the same IP address.

    dazberry, I think the problem is he's not connecting at all to let him look at a blank window waiting for a HTTP request to be sent!


  • Registered Users Posts: 7,110 ✭✭✭Brussels Sprout


    syklops wrote: »
    OP, it could maybe be a firewall blocking it. If it sees the executable telnet, and goes "oooh, bad telnet", it might be blocking it, despite the fact you just want to use it to talk HTTP to a web server

    Would that firewall be on my side or the server side? (apologies if that's a ridiculous question)


  • Registered Users Posts: 2,022 ✭✭✭Colonel Panic


    It would be the firewall on your side. On the server side, it should at least let you connect.


  • Advertisement
  • Registered Users Posts: 7,110 ✭✭✭Brussels Sprout


    It would be the firewall on your side. On the server side, it should at least let you connect.

    Ok so should I attempt to disable this for telnet or should I just download one of those other programs altogether?


  • Closed Accounts Posts: 18,966 ✭✭✭✭syklops


    Would that firewall be on my side or the server side? (apologies if that's a ridiculous question)

    Your side, as a webserver would not normally block traffic to port 80.

    If you run ncat, you should be able to run it in verbose mode(-v or -vv), so it will tell you exactly what is happening.

    On my machine when I run nc(similar to ncat), I get:
    [syklops@newgrange ~]$ nc www.udacity.com 80 -vv
    Connection to www.udacity.com 80 port [tcp/http] succeeded!

    I then proceed to try and grab the index page by doing :
    GET index.html HTTP/1.1

    It says the URL does not exist but at least I get something back from the server so I know it is accepting requests.


  • Registered Users Posts: 2,149 ✭✭✭dazberry


    dazberry, I think the problem is he's not connecting at all to let him look at a blank window waiting for a HTTP request to be sent!

    If he's specifying (o)pen, he's running from the (Microsoft) Telnet> prompt, and the screen does not clear when you run it this way and it looks like it has frozen but has connected as it's waiting for a request.

    D.


  • Registered Users Posts: 7,110 ✭✭✭Brussels Sprout


    syklops wrote: »
    Your side, as a webserver would not normally block traffic to port 80.

    If you run ncat,

    I installed nmap/ncat and then was able to run ncat from the command line by prefacing the host with the word ncat. Thanks for that.

    One more thing. I got back some information from a server but there was so much there (a big webpage) that I couldn't scroll all the way back up to where I had typed my request information. Any idea how to resolve that?


  • Registered Users Posts: 5,246 ✭✭✭conor.hogan.2


    telnet
    set logfile telnetlog.txt
    o www.udacity.com 80

    then:
    GET / HTTP/1.0
    Host: www.udacity.com

    works on Windows.

    Putty and telnet in cmd prompt both do not show all results. I am sure there is probably some equivalent to less or more around. Putty seems to just exist on request.


  • Closed Accounts Posts: 18,966 ✭✭✭✭syklops


    By connecting to port 80 of a webserver, you are emulating the behaviour of a web browser. What you don't see is that the web browser takes what you have seen and converts the markup tags into more readable text and presents a nice looking(though often not) web page.

    Raw markup can be mutiple times larger than the text it needs to display. For example, to print "hello world" in HTML, can take as much as 5-10 lines of markup code.

    Thankfully you can redirect the output of netcat to a file using command redirection operators. To do this type
    ncat host port > saved_output.txt

    In the above example, host is the address you are connecting to and port is the port number(80).

    See Using command redirection operators for more information


Advertisement