User`s guide

KwikNet Overview
K
A
DAK
23
1.8 KwikNet Console Driver
The KwikNet sample programs provide support for a simple, interactive console device.
The console driver, module KNCONSOL.C, is located in the toolset dependent installation
directory TOOLXXX\SAM_COMN (see Chapter 3.6). The console driver can be adapted to
use any of several possible console devices, including a terminal connected by a serial
UART interface, a PC screen and keyboard or a remote Telnet terminal.
To select a particular console device, edit the sample program's application header file
KNZZZAPP.H and change the definition of symbol KN_CS_DEVTYPE as instructed in the
file. Note that a unique application header file
KNZZZAPP.H is provided with each
KwikNet sample program.
The basic KwikNet TCP/IP Sample Program uses the console device for displaying
messages logged by
KwikNet and the application. The data recording procedure
kn_logmsg() in module KNRECORD.C echoes each message it receives to the console
device. You can disable this display of recorded messages by setting the value of symbol
KN_REC_CONSOLE to 0 in the sample program's application header file KNZZZAPP.H.
Other KwikNet sample programs (FTP Option, Web Server, etc) provide a simple
command interpreter which allows you to interact with the program to control its
operation. Since the console device is used by the application, it cannot be used by the
recording service to display KwikNet messages. Hence, for these programs, symbol
KN_REC_CONSOLE is defined to be 0 in the sample program's application header file
KNZZZAPP.H.
The interactive KwikNet sample programs implement a dump command to display the
recorded messages. These applications call procedure kn_loggets() in module
KNRECORD.C to extract all of the message strings from the recording array. The extracted
messages are displayed on the console device.
Warning
The message recording services are not reentrant. Hence,
the dump command implemented by some KwikNet sample
programs should only be used when KwikNet is not active
since the extraction of messages for display may occur
concurrently with the generation of messages by KwikNet.
If you use the Telnet console device, the dump command
must be used with caution. Since KwikNet must be active
for the Telnet console driver to operate, KwikNet may
generate several messages for every message that is
dumped, especially if you have enabled most of the KwikNet
debug and trace options.