[Gambas-user] A couple of questions about building web / cgi applications

Bruce Cunningham bcunningham at ...3336...
Thu Feb 12 23:27:36 CET 2015


Benoît,

What I mean by main application is a GUI application that is always running, reading sensor data, controlling relays and updating the graphical user interface.  It needs to be as close to real-time as I can get.  By CGI module, I mean a CGI script that is invoked by web requests coming in to the web server, which would be a transient process.  It takes some parameters from the web request, reads or updates data from the main application, sends back an html response, and then terminates.

I want them as separate processes so that if someone tries to DDOS the web interface, they (hopefully) won't kill the main application that needs to control stuff.

I was hoping someone had an example of a CGI application they would be willing to share?

Bruce

Bruce Cunningham
bcunningham at ...3336...


-----Original Message-----
From: Benoît Minisini [mailto:gambas at ...1...] 
Sent: Thursday, February 12, 2015 1:59 PM
To: mailing list for gambas users
Subject: Re: [Gambas-user] A couple of questions about building web / cgi applications

Le 12/02/2015 19:09, Bruce Cunningham a écrit :
> I'm looking for some advice and maybe some code examples for a project 
> I'm starting.  I'm building an embedded device with an ARM based 
> System-On-Module (similar to an Rpi, but in an sodimm form factor).
>
> Thanks to some great help from members of this mailing list, I have 
> successfully compiled Gambas for the SOM.  The device will have a 
> "main" GUI application that handles the user interface and all of the 
> control logic.  However, it will also have a web interface for remote 
> access to some of the control settings.
>
> Here are my questions:
>
> 1) Does anyone have any code examples for CGI applications in Gambas?
> I know there is an option to use the Gambas interpreter to build 
> ASP-like pages, but I would rather the web code be in compiled into a 
> CGI module instead (for security reasons).  I've built CGI 
> applications in VB6, so I have a fairly good understanding how CGI 
> work in general.  I've read the Gambas docs on CGI, but I still don't 
> quite understand it.
>
> 2) What is the easiest way to exchange data (variables and arrays) 
> between the CGI module, and the main application?  Using a file on 
> disk is not a great option, since the device will be using flash for 
> the file system, and these values will be changing several times a 
> second.  That will kill the flash very quickly.
>
> Thanks,
>
> Bruce Cunningham
> bcunningham at ...3336...<mailto:bcunningham at ...3336...>
>

I don't understand what you don't understand in Gambas and CGI.

By using the gb.web component, your Gambas project becomes a CGI application (or CGI script or whatever you want to call it) :

- the gb.web component takes the CGI environment variables and present them with a nice ASP-like interface.

- The Request class analyzes the HTTP request for you: it can understand GET arguments, POST arguments, handle file uploads for you.

- The Response class allows you to send a response with its Mime datatypes, and other custom HTTP headers.

I don't understand your story of having a "CGI module" (what's that?) and a "main application".

So, please elaborate.

--
Benoît Minisini

------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Gambas-user mailing list
Gambas-user at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user




More information about the User mailing list