Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12606 Discussions

Sending requests to BOA while CGI is running...

Altera_Forum
Honored Contributor II
1,104 Views

Hi all, 

 

My problem is very simple : 

 

After choosing some parameters in a classic HTML page, a CGI script is launched (according to the user parameters) but the program inside the cgi is very long (sometimes 10 minutes). The CGI execution is not the problem here it works perfectly ! During this execution, the main HTML page remains static and I decided to add some Javascript to indicate the time to the user for example or better, some C variables used inside the CGI ! 

 

My first idea to indicate some CGI variables to the user during the operation directly in the main HTML page was : 

 

1) into the C-code, write periodically a HTML file like "value.html" in the FTP folder of uClinux (chmod /home/ftp 777) 

2) the Javascript updates periodically into the main page an iframe (balise <iframe src="...">) with "../ftp/value.html" file as a source 

 

I successfully tried this manipulation in a local way (so Javascript code is good) but when I want to adapt it to BOA, it seems that the webserver does not accept requests from the client while executing the CGI.... 

 

does anyone knows a solution to allow boa to accept client requests during the cgi execution ??? 

 

Thanks for your help !
0 Kudos
6 Replies
Altera_Forum
Honored Contributor II
399 Views

Apache can connect to an already running CGI program. This is an extension to the normal way CGI works. 

 

I don't think that boa can do something like this.  

 

I suggest you create an always running daemon program that does the complex work and have the CGI program communicate with that daemon via a pipe. 

 

-Michael
0 Kudos
Altera_Forum
Honored Contributor II
399 Views

 

--- Quote Start ---  

I suggest you create an always running demon program that does the complex work and have the CGI program communicate with that demon via a pipe. 

 

-Michael 

--- Quote End ---  

 

This is actually exactly something I need to do as well and I'll be looking into it more once I roll around the the CGI/web part of the application.
0 Kudos
Altera_Forum
Honored Contributor II
399 Views

I know that the way apache accesses cgi programs in case that they are already running and how it starts such programs is a "standard". It defines how to do this via TCP/IP and via pipe. (I forgot the name of the standard.) Moreover I know at least one "gateway" cgi program (done in Pascal), that can be called in the normal CGI way and converts the call according to that standard.  

 

So I suppose adhering to this standard access method is a good idea. 

 

Let me know how you proceed. 

 

-Michael
0 Kudos
Altera_Forum
Honored Contributor II
399 Views

Do you mean fastcgi? 

 

Hein
0 Kudos
Altera_Forum
Honored Contributor II
399 Views

Yep. 

-Michael
0 Kudos
Altera_Forum
Honored Contributor II
399 Views

The best is to use JSON format with AJAX on your HTML.  

You have to create a new CGI wich is able to ask value to your main program thanks to signals. The "small" CGI will be launch by an AJAX request on your html page. 

 

It's work for sure.
0 Kudos
Reply