Solved

telnet not working with file input

Posted on 1997-08-14
7
245 Views
Last Modified: 2013-12-23
We want to get an HTML page as a file in UNIX. It worked when we type "telnet foo.bar.com 80 http/1.0" then in telnet "GET /whatever/thing?arg<CR><CR>". However, if we put the GET command into a file (with 2 blank lines for the <CR>s) and then go "telnet foobar 80 http/1.0 < cmdfile" , then 9 times out of ten the page stops half way (when the CGI on the other end start to look things up). The task then hangs, until I press ^Z, then telnet exits. That is so strange. Why does it work manually but not when the command is in a file? And why would ^Z end it while ^C wouldn't?? thanks!
0
Comment
Question by:tpchai
7 Comments
 

Author Comment

by:tpchai
ID: 1582263
Edited text of question
0
 
LVL 84

Expert Comment

by:ozo
ID: 1582264
Do you have expect(1) on your system?
If so, you could control a telnet script with that.
If not you might try the Net::Telnet module in Perl.
Or else use some other URL grabbing prog, e.g.
(echo $username; echo $password) | request 'http://www.experts-exchange.com/topics/bin/ShowQ?qid=8630013784'
0
 

Author Comment

by:tpchai
ID: 1582265
We have neither the expect nor request commands on our system (system V release 4.0) The Net::telnet module in Perl; is that a library with Perl 5? I am only a casual user of Perl 4.
0
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
LVL 84

Expert Comment

by:ozo
ID: 1582266
I think it is Perl5, (as are some modules which duplicate expect,
and the request program)
But it looks like there may be a Perl4 version at
http://www.ics.uci.edu/pub/websoft/libwww-perl/
http-get looks like it may be Perl4 too.
Can you upgrade to Perl5?
(that's probably worth doing regardless of the resolution of
this problem)
It looks like there are other non-perl utilities to get html
pages too, maybe `netscape -remote`?
 

0
 
LVL 5

Accepted Solution

by:
julio011597 earned 200 total points
ID: 1582267
Hello,

AFAIK, the problem is that you should NOT telnet to a web server, since the telnet protocol involves some negotiation.

So, you may still telnet to a web server for testing purposes, but you are not guaranteed that that would work.

To get a page, you should write a simple client program which makes a socket connection to the web server.

Regards, julio
0
 

Expert Comment

by:bkc
ID: 1582268
This problem has nothing to do with telnet option negotiation as suggested by julio. Telnet clients are 'mum' until they receive a telnet option from the telnet 'server'.

If they do not receive such an option, they operate in 'line mode'.

My suggestion is to get lynx for your system. Lynx is rather popular and you can probably get it precompiled.

You can use the lynx -dump option to send the output to a file.

0
 

Author Comment

by:tpchai
ID: 1582269
Although julio's message doesn't actually answer why it's doing that, we are going to write a program with sockets, as suggested also by our sys admin (who is going to do it.) Lynx was an option I had considered, so thanks also to bkc for suggesting the -dump option (which I didn't know of.)
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
RDP Sonicwall 8 66
policy routing to fw2 18 50
Creating and Connection two new domains 5 75
SOFS cluser offline 3 39
This is an article about my experiences with remote access to my clients (so that I may serve them) and eventually to my home office system via Radmin Remote Control. I have been using remote access for over 10 years and have been improving my metho…
When it comes to security, there are always trade-offs between security and convenience/ease of administration. This article examines some of the main pros and cons of using key authentication vs password authentication for hosting an SFTP server.
After creating this article (http://www.experts-exchange.com/articles/23699/Setup-Mikrotik-routers-with-OSPF.html), I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

929 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now