Solved

telnet not working with file input

Posted on 1997-08-14
7
249 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
mlppp with hsrp tracking? 2 28
HP Storage and Cisco Nexus 4 71
Wifi Router Confliction with Network 12 47
Basic nexus configuraton 11 19
Data center, now-a-days, is referred as the home of all the advanced technologies. In-fact, most of the businesses are now establishing their entire organizational structure around the IT capabilities.
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
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…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

732 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