Hi Matt, your first assumption was correct. I just want to write a C
program
that use a combination of fork and pipe to run "/usr/bin/telnet" and send
and receive commands/data via telnet pipes. What I am after is I want to
be able to create a two way pipes, telnet from a local UNIX machine
to a remote Unix machine, login, continue to keep the pipe open and
excute some remote UNIX scripts or binary programs from remote machine.
The output comes back thru pipe.
I can not use perl or expect. My main program is already written in C.
Thanks in advance.
John
----- Original Message -----
From: Matt Fahrner <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, May 02, 2000 10:23 AM
Subject: Re: Telnet program
> 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
>
--
To unsubscribe:
mail -s unsubscribe [EMAIL PROTECTED] < /dev/null