AMX DESIGN XPRESS V 1.5 - PROGRAMMER GUIDE User's Guide Page 156

  • Download
  • Add to my manuals
  • Print
  • Page
    / 316
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 155
142
K
A
DAK
KwikNet Low Level Services
Starting and Stopping KwikNet
Most applications start KwikNet with a call to kn_enter() and allow KwikNet to run
forever. Some use kn_exit() to stop KwikNet in preparation for a termination of the
entire application. Others find it necessary to stop and then restart
KwikNet to recover
from serious network faults. The ability to start and stop
KwikNet on demand is also
useful when testing your network application.
KwikNet is started with a call to kn_enter(). Procedure kn_state() can then be used to
detect when KwikNet is fully operational.
KwikNet can only be stopped if you enabled KwikNet to shut down. This feature is enabled
by a configuration parameter in the KwikNet Network Parameter File used in the
construction of the
KwikNet Library as described in Chapter 2.3. When you define your
KwikNet configuration, simply check the option box labeled "KwikNet can be shut down" on
the General property page.
Before KwikNet can be stopped, your application must cease using all KwikNet services.
You must ensure that all KwikNet resources such as UDP channels and TCP or UDP
sockets have been relinquished. Do not forget that all dedicated KwikNet clients and
servers (such as those for FTP, HTTP, TELNET, TFTP, SMTP and SNMP) must have
been stopped in an orderly fashion. The private KwikNet DHCP and DNS clients will be
stopped by KwikNet.
KwikNet is stopped in two steps. The first step is to wait long enough for all unfinished
network transactions to complete. KwikNet procedure kn_godown() provides this service.
Your application can call kn_godown() to start the shutdown process and wait, up to
some maximum interval, for the process to complete.
The second step is to force KwikNet to shut down all networks and their device drivers and
release all memory and operating system resources. This process is initiated with a call
to kn_exit(). Procedure kn_exit() does not return to the caller until KwikNet has fully
stopped. Then, and only then, can KwikNet be restarted.
If your application does not call
kn_godown() to shut down KwikNet before calling
kn_exit(), KwikNet will automatically attempt a shutdown, waiting up to two minutes for
the process to complete before finally stopping. In this case, if the shutdown fails,
KwikNet will initiate a fatal exit.
In a multitasking system, procedures kn_godown() and kn_exit() can only be called
from an application task executing at lower priority than the KwikNet Task. In a single
threaded system, the procedures must be called from your App-Task.
Warning!
You must not shut down KwikNet unless KwikNet's memory
is allocated from a static array or from a fixed region of
memory acquired when KwikNet is started and released
when KwikNet is stopped.
Page view 155
1 ... 155 156 157 ... 316

Comments to this Manuals

No comments