EmbeddedRelated.com
Forums

LPC 2124 Webserver new cgi-file

Started by lpc_peter November 21, 2005
Hi

I am using the lpc 2124 Ethernet board. Now i am building a new cgi
file but it is not really working. i linked the new cgiwebpage and i
can open it, but the cgi script is not right working.
the script should only count like a clock for example step up every 5s
and refresh the webpage.
In folder fs i took an other cgi file as example and like this i made a
new funktion calles "d". tion is also included in cgi.c at cgifunction
cgitab[]
my problem is, i think, that cgi scrips wirtes data to the buffer and i
dont. deas somebody wrote a manual f cgi programming?

and the second problem does the cgi file refresh by it own or does i
reload the webpage continuously writen in html refresh?

Regards


An Engineer's Guide to the LPC2100 Series

>In folder fs i took an other cgi file as example and like this i made a
>new funktion calles "d". tion is also included in cgi.c at cgifunction
>cgitab[]

From these three lines I am guessing that you are using uIP...if so then did
you run the makefsdata script after changing the html and cgi scripts? >and the second problem does the cgi file refresh by it own or does i
>reload the webpage continuously written in html refresh?

You can include a refresh request in the html that is served - telling the
browser to refresh and the required frequency.

Regards,
Richard. http://www.FreeRTOS.org

----
----
YAHOO! GROUPS LINKS

a.. ----
----


--- In lpc2000@lpc2..., "FreeRTOS Info" <nospam@F...> wrote:
>
> >In folder fs i took an other cgi file as example and like this i
made a
> >new funktion calles "d". tion is also included in cgi.c at
cgifunction
> >cgitab[]
>
> From these three lines I am guessing that you are using uIP...if so
then did
> you run the makefsdata script after changing the html and cgi
scripts?
>
yes after changing html and cgi i rum makefsdata. but maybe i chose a
wrong way. i thought cgi calls funktions a(prinz_stats),b
(file_stats) and c (tcp_stats)form cgi.c. so i included a fuktion
called "d" for my counting and this is not in folder fs. but Rowley
CrossStudio compiled and downloaded it to ARM uC.
So cgi part of new fsdata.c should call my funktion "d"

But the cgi webpage is not found

>
> >and the second problem does the cgi file refresh by it own or does
i
> >reload the webpage continuously written in html refresh?
>
> You can include a refresh request in the html that is served -
telling the
> browser to refresh and the required frequency.
>
i will do so

Regards

> Regards,
> Richard. > http://www.FreeRTOS.org >
>
> --------------------------------
--------
> ----
> YAHOO! GROUPS LINKS
>
> a.. > --------------------------------
--------
> ----
>




> yes after changing html and cgi i rum makefsdata. but maybe i chose a
> wrong way. i thought cgi calls funktions a(prinz_stats),b
> (file_stats) and c (tcp_stats)form cgi.c. so i included a fuktion
> called "d" for my counting and this is not in folder fs. but Rowley
> CrossStudio compiled and downloaded it to ARM uC.
> So cgi part of new fsdata.c should call my funktion "d"
>
> But the cgi webpage is not found
>

There are two components to the cgi functionality
- the cgi script itself which is built into the file system by use of
makefsdata.
- the function that is called by the cgi script which is compiled as part of
the code.

Here is a basic example.

1) Generate a new cgi script that calls function d. Lets call this cgi
script test, so it is saved in a file called test (no extension) in the
directory uip/fs/cgi. This script transmits the text "this text is
transmitted" then calls function d.

script start-----------
t <html><head></head><body>
t this text is transmitted
c d
</body></html>
script end-----------

The line "c d" is where function d is called.

2) Write function d. The function name is going to be called CGI_tx() and
will just transmit the text "this text is coming from the function".
Write the function in the file uip/cgi.c.

function start--------
#define TX_TEXT "this text is coming from the function"

static u8_t CGI_tx( u8_t next )
{
____uip_send( TX_TEXT, strlen( TX_TEXT) );
}
function end-------- 3) Place the function in the CGI function list array as follows:

cgifunction cgitab[] = {
print_stats, /* CGI function "a" */
file_stats, /* CGI function "b" */
tcp_stats, /* CGI function "c" */
CGI_tx /* CGI function "d" */
}; 4) Run makefsdata - this will compile the cgi script generated in step 1
into the file system.

5) Compile your program.

6) Run program and brows to http://aa.bb.cc.dd/cgi/test

Regards,
Richard. http://www.FreeRTOS.org