In order to provide flexibility for a developer, a network API is provided
which allows for a network event (for example, the receipt of data over
the network) to be handled by one thread from among a predetermined
number of dedicated threads. The number of dedicated threads is specified
by the application at runtime and can be modified at runtime as well.
Where the number of dedicated threads specified is greater than zero,
dedicated threads are created which handle network events and call the
specific callback functions of the application in response to the network
events. Thus the number of such callback events from threads that can
occur at one time is limited by the number of dedicated threads specified
by the application. When the number of dedicated threads is specified as
zero, no callback events can occur except when the application assigns a
certain time period for them. Thus, when the number of dedicated threads
created is zero, the application has control over the amount of
processing time allotted to the network layer. Network events are handled
when the application issues calls a "Do Work" method. While executing
this method, network events are handled.