The Powernet Telnet server is a multithreaded server that can accept multiple Telnet connections. Local echo is not required on the client. The model used is described in SERVERS.FTH.
For testing, please be aware that the standard Windows Telnet client is very slow. A nuch faster alternative is HyperTerminal Personal Edition from:
http://www.hilgraeve.com
These data definitions are required by each Telnet server task. The data
is allocated at the start of the task and released when the task is
TERMINATE
d. The chain SVCHAIN
links all the service tasks.
#5023 equ TelnetPort# \ -- n ; standard is 23
Define the port used for the Telnet server. The standard
port is 23, but 5023 is the default set for PowerNet as
most application Telnet servers are private.
Moved to PNconfig.fth.
Not yet implemented.
: DoEscapeSequence \ addr -- n
Process a character sequence with the TNET_IAC escape
character at addr, returning n = decoded length.
At present these sequences are ignored.
: ParseTelnetBuffer \ numchars --
Process incoming Telnet data.
The Telnet server establishes its own generic I/O based on that in SERVERS.FTH in order to handle IAC processing in the future.
create ConsoleTN \ -- addr ; OUT managed by upper driver
Function despatch table for Telnet I/O.
OUT
is managed by the upper level driver.
: Init-ConsoleTN \ --
Initialise for console I/O by Telnet. Note that the
Telnet socket must have been set up and and the private
service area initialised.
/SVdata equ /TNdata \ -- len
Required size of console service area.
: Console=Telnet \ --
Select Telnet as the console.
: tn_announce \ --
Issues Telnet signon message.
: (tn_login) \ -- ior
Perform the default login procedure and return non-zero
if successful so that the return code can be used as a
user identifier by higher level code if required
defer tn_login \ -- ior
Perform the assigned login procedure and return non-zero
if successful so that the return code can be used as a
user identifier by higher level code if required. When
zero is returned for unsuccessful login, the Telnet
session is terminated. See TelnetService
.
: tn_quit \ --
Empty the return stack, store 0 in SOURCE-ID
, and
enter interpretation state. TN_QUIT
repeatedly
SVaccept
s a line of input and INTERPRET
s it, with
a prompt if interpreting and ECHOING
is on. Note that
any task that uses TN_QUIT
must initialise 'TIB
,
BASE
, IPVEC
, and OPVEC
. Note that
TN_QUIT
clears the stack on exit.
: TNbye \ --
Use this to close the connection in Telnet.
: TelnetService \ --
The Telnet service task launched for each established
Telnet connection.
: TNserverPass \ --
One iteration through the Telnet server.
: TelnetServer \ -- ; stay here forever
The Telnet listening task.
: TelnetServer \ -- ; stay here forever
The Telnet listening task.
0 value TelnetTask \ -- 0|task
Returns 0 or the Telnet server task if running.
: RunTelnetSockTask \ --
Start the Telnet server task.
: StopTelnet \ --
Stop the Telnet server.
This code is only compiled if the EQU
ate DIAGS?
is set non-zero.
: .TelnetChain \ --
Display data about the Telnet sockets.
: .tn \ -- ; synonym
Display data about the Telnet sockets.