Board index » delphi » Telnet server question

Telnet server question

Hi !

I'm currently writing telnet server daemon. I know how to work with
sockets but the problem is the command iterpreter: When client from
another machine sends a command (e. g. dir), the server executes the
command and sends the result back to the client. How can I read the
answer that a certain command produces ? How is it done in win NT ? I
know it has something to do with windows consoles and their handles.

Thanks in advance,

Tomi Nurma
Optimitekniikka OTT Oy
Laserkatu 6
FIN-53850
Lappeenranta
Finland

mailto:nu...@ott.fi
http://www.ott.fi

tel:+358 5 624 3198
fax:+358 5 624 3197

 

Re:Telnet server question


Quote
Tomi Nurma wrote:
> Hi !

> I'm currently writing telnet server daemon. I know how to work with
> sockets but the problem is the command iterpreter: When client from
> another machine sends a command (e. g. dir), the server executes the
> command and sends the result back to the client. How can I read the
> answer that a certain command produces ? How is it done in win NT ? I
> know it has something to do with windows consoles and their handles.

You need to spawn a shell (DOS, 4NT, whatever) whenever a user logs on, with STDIN/STDOUT and STDERR
redirected to anonymous pipes. I've got some sample code for this on my homepage.

However, if the user attempts to e.g. run DOS Edit (MS's only bugfree app), the shell will seem to
be hung, as edit along with lots of other DOS apps do not use STD* for I/O, but rather directly
access (what they believe is) the screen memory buffer. To handle these apps as well, you'll
probably need to run the shell visibly (offscreen in 95, private desktop in NT), and continously
poll the console screen buffer for changes. Differing memory images should be analyzed and the
changes passed to the telnet clients using whatever protocol you're supporting. The theory is not
very complicated, but I suspect it'll be heck of a job to implement.

Regards,

Erik.

--
Development of applications and drivers for Windows 95 and NT.
Go visit http://www.POBoxes.com/Sperling for some free source!
Check out Delphi Bug Lists at http://www.POBoxes.com/DelphiBugList
PGP public key available at http://www.POBoxes.com/Sperling/pgpkey.txt

Erik Sperling Johansen, Sperl...@POBoxes.com (DeBug Team; checker, monitor)

Other Threads