cURL / Mailing Lists / curl-library / Single Mail


Suggestion for telnet not using stdin

From: codemastr <>
Date: Sat, 18 Oct 2003 15:16:02 -0400

Just wondering about this. Like the TODO list says, using stdin is bad for a
library (especially with Windows where stdin might do nothing in a GUI app,
or even on *nix with a forked() program). What I'm wondering is, what about
doing something where the user can specify an input fd? Like a
CURLOPT_TELNETINPUTFD or something (well I guess that'd actually be a FILE
*, but same idea)? This value could default to stdin so that it works the
same in existing programs, but for someone who doesn't want to/can't use
stdin, they can change it. The only thing I'm wondering is about Windows.
Since WaitForMultipleObjects can't wait on a fd/FILE * there needs to be
some way to convert it to a HANDLE and I'm not 100% sure Win has a function
to do that, but I'll do some looking. I know that MSVC++ has a way to
convert a FILE * to a HANDLE, _get_osfhandle(_fileno(the_file_ptr));, but
that isn't a WinAPI call, it is part of the MSVC++ C runtime library. Is
curl compatible with other win32 compilers? Meaning, does it matter if
MSVC++ specific functions are used?

This probably isn't a perfect solution either, it still requires that
seperate select() loop, but it seems better than forcing a program to use

Dominick Meglio

This email sponsored by: Enterprise Linux Forum Conference & Expo
The Event For Linux Datacenter Solutions & Strategies in The Enterprise
Linux in the Boardroom; in the Front Office; & in the Server Room
Received on 2003-10-18