HTTP Server Support
6-15
Network Tools Library Services
http_example()
{
CI_SERVICE_HTTP http;
bzero( &http, sizeof(http) );
http.cisargs.IPAddr = INADDR_ANY;
http.cisargs.pCbSrv = &ServiceReport;
CfgAddEntry( hCfg, CFGTAG_SERVICE, CFGITEM_SERVICE_HTTP, 0,
sizeof(http), (UINT8 *)&http, 0 );
}
The above code is all that is required when using the configuration system to
invoke this service.
6.5.6
Invoking the Service via NETTOOLS API
In addition to the configuration option, this service can also be created and de-
stroyed directly through this NETTOOLS API. If an application wishes to by-
pass the configuration system and launch the service directly, these calls can
be used.
Start the HTTP Server
HTTPOpen
Syntax
HANDLE HTTPOpen( NTARGS *pNTA );
Parameter(s)
pNTA
Pointer to common argument structure used by all services
Return Value
Returns a handle to the HTTP Server instance, or NULL if the HTTP Server
task could not be created. This handle is used with HTTPClose() to shutdown
the client when its no longer needed.
Description
HTTPOpen() starts the HTTP server process. This process will create a con-
nection to the HTTP Port and listen. When a connection is made, another task
will be created to service the request.
Destroy an Instance of the HTTP Server
HTTPClose
Syntax
void HTTPClose( HANDLE hHTTP );
Parameter(s)
hHTTP
Handle to a HTTP server instance obtained from
HTTPOpen()
Return Value
nothing
Description
Destroys the instance of the HTTP Server indicated by the supplied handle.
Once called, the Server is shutdown.