cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Telnet

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Fri, 14 Feb 2003 10:24:12 +0100 (CET)

On Tue, 11 Feb 2003, Alex Pavloff wrote:

> I've been looking for a way to programatically drive a telnet session.
> libexpect appears to not be suited to multithreading.
>
> So I look at curl, but it appears that the telnet implementation is not
> optimal, in that sending data to the remote device doesn't appear to work,
> according to a test program and a year old post on this list.

It doesn't work? The last time I tried it, it worked fine. I just tried again
now, and yes I could login to my localhost over telnet just fine.

> So if libcurl doesn't work,

I think the wording should be: it doesn't work the way you'd want it to.

> 1) what needs to be done to make it work? or

It already works.

> 2) are there any other options for programatically driving a telnet session?

I'll tell you what you'll soon find out needs to be fixed to make libcurl a
nice library to drive telnet with:

libcurl is currently not suited for actions that provides data, sits silent
and then provides data again. It kind of assumes both flows to be set to
"full speed" all the time.

While libcurl has no problem uploading and downloading data at the same time,
it currently works like this:

  while (not done) {

    select ( is socket writable )

    call callback to get data to upload

    upload data

  }

And when the callback returns 0, it treats the upload as if it is done, and
aborts further transfer.

What needs to be fixed to make this a nicer library for telnet purposes (and
I *believe* that the PHP dudes want something similar as well), is a kind of
boolean on both download and upload, that you set programatically if you have
data to deliver to the server or if you want to read data from the server.
Then that upload-callback would only be called if you have told the library
that you have data to upload etc.

If you investigate a bit more on how the code works today, my yapping might
make some more sense. Anyway, ask again if there are details I should clarify
more.

-- 
 Daniel Stenberg -- curl, cURL, Curl, CURL. Groks URLs.
-------------------------------------------------------
This SF.NET email is sponsored by: FREE  SSL Guide from Thawte
are you planning your Web Server Security? Click here to get a FREE
Thawte SSL guide and find the answers to all your  SSL security issues.
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0026en
Received on 2003-02-14