?
Solved

telnet not working with file input

Posted on 1997-08-14
7
Medium Priority
?
251 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
Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

 
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

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

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

ADCs have gained traction within the last decade, largely due to increased demand for legacy load balancing appliances to handle more advanced application delivery requirements and improve application performance.
This article explains the fundamentals of industrial networking which ultimately is the backbone network which is providing communications for process devices like robots and other not so interesting stuff.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Suggested Courses

770 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