I would like to execute something like 'cat foo | telnet host port'
where foo is a regular file.
I've also tried something like 'telnet host port < foo' with nore more
success.
each time, telnet claims that the connection is closed by the foreign
host. and i know the command has not been performed on the remote
server.
i'm sure i did not use pipes properly...
note : i'm using tcsh.
any help?
thanks a lot.
Sent via Deja.com http://www.deja.com/
Before you buy.
Steve
st...@peachy.com
sysadm@mybox> echo quit | telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Connection closed by foreign host.
sysadm@mybox> ( sleep 1 ; echo quit ) | telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 mybox ESMTP Sendmail 8.8.8+Sun/SMI-SVR4 ready at Mon, 3 Jan 2000
12:04:23 GMT
Connection closed by foreign host.
In article <84q012$mo$1...@nnrp1.deja.com>,
> I would like to execute something like 'cat foo | telnet host port'
> where foo is a regular file. I've also tried something like 'telnet
> host port < foo' with nore more success. each time, telnet claims
> that the connection is closed by the foreign host. and i know the
> command has not been performed on the remote server. i'm sure i did
> not use pipes properly... note : i'm using tcsh.
Try using `netcat'. That should be what you need. Also Perl can deal
with things like that.
--
"Who needs more than 640k? We do, Bill."
http://www.linux.org/
Kevin Wilson, Imperial College, London. [Please do not reply via e-mail]
-------
What are you trying to do? Are you trying to pass files between two
machines? netcat works pretty much like telnet, if i remember
correctly, but will keep the port open, unlike telnet, after EOF. But you
talk about remote command too so maybe a remote shell is what you're
looking for.
man rsh
man rcmd
Chris
DING! Don't do that. (cat foo |). Read:
http://www.ling.helsinki.fi/users/reriksso/unix/award.html
> I've also tried something like 'telnet host port < foo' with nore
more
> success.
That's more like it.
> each time, telnet claims that the connection is closed by the foreign
> host. and i know the command has not been performed on the remote
> server.
Someone already suggested rsh. But I think that requires user/host
equivalence. If you don't have that you might be helped by "expect". A
tool with which you can spawn sessions and feed them with commands.
(well, you can do much more than that). The expect distribution comes
with a command called autoexpect that works somewhat like the "script"
command. You can record interactive sessions and get the expect script
that would repeat what you just did. You can massage that script to
feed the other host with those command you have in your foo file.
FWIW,
/Peter
--
-= Spam safe(?) e-mail address: pez68 at netscape.net =-
thanks a lot for your help.
i didn't want to perform commands on a remote host but simply do
something like this :
telnet www.foo.com 80 < foo
where foo is regular file containing "get /foo.html\n\r\n\r" :-)
but it doesn't work this way.
netcat seems to be exactly what i need. i'll try it.
-->
-->
-->thanks a lot for your help.
-->
-->i didn't want to perform commands on a remote host but simply do
-->something like this :
-->
-->telnet www.foo.com 80 < foo
-->
-->where foo is regular file containing "get /foo.html\n\r\n\r" :-)
-->
-->but it doesn't work this way.
-->
-->netcat seems to be exactly what i need. i'll try it.
Telnet is a program basically for emulating the command line interface on a
remote machine to the local screen. It's really not useful for file
transfers. Ftp is the basic place you would start, as it's a file transfer
utility. When you use the 'get' command in your example above you are
using a standard ftp command; telnet doesn't include 'get' as a command.
There are other utils besides ftp for remote file transfer across networks.
Good luck, /ts
tenox @ home dot com
>Telnet is a program basically for emulating the command line interface on a
>remote machine to the local screen. It's really not useful for file
>transfers. Ftp is the basic place you would start, as it's a file transfer
>utility. When you use the 'get' command in your example above you are
>using a standard ftp command; telnet doesn't include 'get' as a command.
>There are other utils besides ftp for remote file transfer across networks.
Well, that looks a lot more like a http transfer than a ftp
transfer, but the advice is still sound --- programs such as
lynx or GNU's "wget" are better suited to this task than is
telnet. While netcat is a very useful program to have, and
can be used effectively for this, it is not the most natural
tool for grabbing a text over http.
--Ken Pizzini
There are also programs like FreeBSD's fetch (and its
`libfetch' library) that handle all sorts of URLs: file, http,
ftp, ...
See http://www.FreeBSD.org/cgi/man.cgi?fetch
- Chris Costello <ch...@FreeBSD.org>