The ARM Webserver code itself needs no internal setup. The C compiler will initialize all the internal lists and structures to the appropriate values. However, there are one or two initialization activities that must occur on the target system before it will invoke the webserver:
the initiation of a socket
listenfor webserver operation
optionally, the initialization of a user-extended VFS files system.
In the demonstration
program, these activities are both addressed in a single function, the
http_init(), which can
be found in the
To set up the TCP/IP
listen, you only need
to copy the code from the demonstration program
into your own file.
A mechanism is needed to sense when an incoming TCP/IP connection
is accepted, and tell the webserver. In the example port, a simple
polling routine checks the TCP/IP
clock tick to see if a connection has formed. If it has, the socket
is passed to the webserver by way of
syntax for this call is:
void http_connection(long sock);
The webserver logic will call
close the socket when it is no longer needed.
In a more sophisticated system (that is, one with UNIX-like
signals) the overhead of polling can usually be avoided by signaling
when the TCP/IP connection is ready, and then calling the
Refer to your system documentation for details.