[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

in search of suggestions

    Date: Thu, 8 Jun 89 18:16 PDT
    From: pwtc!hamscher@labrea.stanford.edu (Walter Hamscher)

    The Select-T Program lets me dial up a remote host, log in, type
    commands, look at the output, etc.  I want to figure out what it would
    take to have a program do the same thing.

    The question is, how do I create a stream with that functionality?  I
    know that somewhere deep in the code for telnet:nvt-window there has to
    be SOMETHING that creates a full duplex character stream, and does :tyi
    and :tyo operations on it, but how do I create this beast outside of
    Select-T ?

Unfortunately, the mechanisms used by the terminal program aren't that
simple.  There are no streams you can just read and write characters

Opening the connection is done with

	(net:invoke-service-on-host :login host)

But this doesn't return a simple character stream.  It returns a binary
stream (the raw network or serial connection), a list of input filters,
and a list of output filters.  The filters are the names of flavors that
must be instantiated, and which do appropriate conversions depending on
the protocol being used.  This facility is really designed only for the
terminal emulator to use: the input and output filters take as
parameters an input and output stream, respectively, and pass the
characters from the connection stream to these streams; the output
filters frequently perform window-specific operations (e.g., when the
ANSI emulator filter sees an escape sequence, it sends appropriate
messages to the window); and the input filters assume they're being used
within the terminal program, and look for the Network key.

And you can't just ignore the filters, because some of them perform
essential services.  They do character set translation, and they handle
various aspects of the network protocols (e.g., the TELNET filter
recognizes TELNET IAC codes and implements option negotiation).

The Terminal emulator program has grown quite complex over the years,
and SYS:NETWORK;TELNET.LISP is probably one of the largest source files
in the Symbolics system.  But this complexity isn't completely
gratuitous.  The protocol modules need to be able to communicate with
the user interface routines, for instance, so that when a TELNET server
negotiates which end will do the echoing, the user interface will know
whether it should be echoing typein.  And if you just did READ-CHARs on
the stream, what would you expect to get when a SUPDUP server sends the
CLEAR-SCREEN character?