Solved

telnet not working with file input

Posted on 1997-08-14
7
243 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
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Lets look at the default installation and configuration of FreeProxy 4.10 REQUIREMENTS 1. FreeProxy 4.10 Application - Can be downloaded here (http://www.handcraftedsoftware.org/index.php?page=download) 2. Ensure that you disable the windows fi…
PRTG Network Monitor lets you monitor your bandwidth usage, so you know who is using up your bandwidth, and what they're using it for.
Viewers will learn how to connect to a wireless network using the network security key. They will also learn how to access the IP address and DNS server for connections that must be done manually. After setting up a router, find the network security…
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…

744 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

12 Experts available now in Live!

Get 1:1 Help Now