Instructions
397 C-Control Pro IDE
© 2013 Conrad Electronic
Web Server Optimization
The lwIP TCP / IP stack is optimized to work best with embedded devices that store websites in
flash memory. The SD card allows to store much more websites than the flash memory of an em-
bedded controller, but has the disadvantage that the web pages must be between loaded to RAM be-
fore they are sent over the Ethernet. To limit the "RAM hunger" of the lwIP stack, several things
should be noted:
In normal web server operation the "TCP/IP Memory" in the C-Control configuration should be set
to ca.16kb.
All GET requests of the web server, that do not pass CGI variables in the URL, are serialized in a
queue. This is done so only few RAM is needed to send a web page at a time.
Because the SD card in the C-Control Pro is connected via SPI, and not in 4-bit parallel mode like
a PC, only slower transmission rates are realized. In tests with wget.exe an average transfer rate
between 140-150 kbytes/sec is reached. Therefore, e.g. Images and other resources should not
exceed 100kb significantly, otherwise the website is built slowly.
The web server supports the "If-Modified-Since" caching protocol of the current web browser.
Therefore, the caching should be enabled in the web browser, and date and time of the files on the
SD card should not lie in the future.
If you want just to pass CGI variables in the URL of a Javascript GET request, without the require-
ment of a response from the server, the URL "setvars.js" should be used. This request takes only
the variable values and generates no response.
If a request from Javascript only accesses variable values in JSON format, the URL "getvars.js"
generates only the JSON output, without accessing the SD card, what is a lot faster.
It is recommended to look at the demo programs for web server usage.
Only specify the flags and WEB_CACHE_HTML and WEB_CACHE_TEXT in WEB_StartServer, if
you are sure that HTML or text web pages really should be cached!
5.27.2 WEB_GetRequest
Ethernet Functions
Syntax
byte WEB_GetRequest(void);
Sub WEB_GetRequest() As Byte
Description
Queries the web server if an HTTP request is made for the delivery of a website. A value of zero in-
dicates that there is no request. After a valid request, you should evaluate the dynamic variables and
set any new values??.
Return Parameter
request parameter (0 = nothing received)