I think everyone's assumption was that you would not "write a telnet
program" but rather use a combination of fork and pipe to run
"/usr/bin/telnet" and then send/recieve commands/data to telnet though
the pipes you have open.

If I'm now reading this right you're saying that you actually want to
write a program that acts as "telnet", that is opens a socket from the
current host to the telnet port on a remote host and then "speaks" the
telnet protocol. If so, this is significantly more work (at least to do
it right) and isn't probably something that can easily be explained over
email. If this is the case then you'll need to create and fill in
"sockaddr_in" structures, use "connect()", "read()", "write", and maybe
even "select()" or "poll()" calls. This isn't trivial. Worse, if you
really want to speak telnet protocol (you can get away with a bare TCP
stream usually, but you have to ignore the extra garbage) then you'll
have to dig up the protocol specs.

So, what are you really after? It might help if you explain why you need
to use telnet in the first place. I suspect this would probably be
easier in "perl" or "expect" using their builtin pipes.

Matt Fahrner
Manager of Networking
Burlington Coat Factory Warehouse

JM wrote:

> Hi, My project is to write a C-Program that telnets into a remote
> machine(using fork and pipe). The parent process does all the inputs
> such aslogin, passwd, execute shell scripts ... and also receive
> outputs fromthe child.Awhile back, someone sent me an example of two
> way pipe that createsboth parent and child which both can send and
> receive data. This examplehelps a little but I still do not know how
> to write a basic telnet program. Can you help? Thanks John
begin:vcard 
n:Fahrner;Matt
tel;pager:(603) 639-4142
tel;fax:(603) 443-6190
tel;work:(603) 448-4100 xt 5150
x-mozilla-html:FALSE
url:http://www.gizzy.com/matt
org:Burlington Coat Factory Warehouse;MIS Networking
version:2.1
email;internet:[EMAIL PROTECTED]
title:Manager of Networking
adr;quoted-printable:;;2 South Park St.=0D=0AWillis House;Lebanon;NH;03766;USA
x-mozilla-cpt:;-3648
fn:Matt Fahrner
end:vcard

Reply via email to