User`s guide

34
K
A
DAK
KwikNet Overview
Running the TCP/IP Sample Program
The KwikNet TCP/IP Sample Program load module is built just like any other KwikNet
application program. The KwikNet Network Parameter File is first created using the
KwikNet Configuration Builder as described in Chapter 2. Then the KwikNet Library must
be produced. Finally the application must be linked with the
KwikNet Library, the RT/OS
libraries and the C runtime library to create a load module suitable for testing with a
debugger. This construction process is explained in Chapter 3.
Since the
KwikNet TCP/IP Sample Program has no visible output unless operated with a
console terminal, its operation can only be confirmed using your debugger. Since the
program has no hardware dependence, it can readily be used with a target processor
simulator, if one is available.
KwikNet includes a number of debug features (see Chapter 1.9) which will assist you in
running the TCP/IP Sample Program. With KwikNet's debug features enabled, you can
place a breakpoint on procedure kn_bphit() to trap all errors detected by KwikNet. Of
course, if you are using AMX, it is always wise to execute with a breakpoint on the AMX
fatal exit procedure cjksfatal (ajfatl for AMX 86).
If you breakpoint at the end of the main() program, you can examine the messages
recorded in memory. The messages are stored sequentially in a character array called
kn_records[]. Variable kn_recordlist[] is an array of string pointers referencing the
individual recorded messages. Most debuggers will allow you to dump the strings
referenced in kn_recordlist[] in text form in a display window. The list of string
pointers is terminated with a NULL string pointer.
If you are connected to the target processor by a serial link, do not be surprised if the
debugger takes quite some time to access and display all of the strings referenced by
kn_recordlist[]. You may be able to improve the response by limiting the display to
the actual number of strings in the array as defined by variable kn_recordindex.
Once you are confident that the KwikNet TCP/IP Sample Program is operating properly,
you may wish to breakpoint your way through the client and server (functions clientN()
and serverN()), monitoring the recorded messages as you go.