[Gambas-user] Gambas called by a Web Server

Cedron Dawg cedron at exede.net
Tue May 21 15:08:34 CEST 2019


Thanks Christof and Tobi,

I'm just in the exploratory stage of this now.  It is good to know that I should be able to use the same code that I am producing the static HTML reports with to serve up dynamic web pages.

I am pretty sure I am heading in the third direction, without any hacking.  It is important that I be able to easily and efficiently maintain persistent sharable application and session level objects.  In the early days of web servers, I wrote a C based CGI relay program which communicated to a running VB3 (or 4) via a file passing protocol.  The same method should work here using a PHP relay and a TCP connection.  There are other advantages too.

I'm almost done with the new class report files.  I'll be posting the code soon.

Ced



----- Original Message -----
From: "Tobias Boege" <taboege at gmail.com>

The merit of a script is that it's slightly easier to deploy I would say.
The great disadvantage of Gambas scripts is that you're effectively limited
to a single class in your project. If you look at the Gambas Wiki program,
it uses multiple classes and even Webpages [1] which clearly beat Print-
based CGI.

Concerning performance, you should know that the scripter is just a Gambas
program that takes your script, builds a proper project directory structure
around it, which gets compiled, *caches that* at least, and then has it run.
The overhead of looking the compiled executable up in the cache and having
to start the regular interpreter anyway makes it even slightly worse than
having a normal project.

For me, all signs point at writing a full project and running its executable.

But there's a third way: an application server. When I lived in the student
dorms, where my friends and I had a shared network, I used to run a bigger
Gambas program for us based on gb.web.form under gb.httpd which was reverse-
proxied by nginx. gb.httpd is sort of building a web server into your
Gambas program. On each new HTTP request, the server parses it, sets up
variables, then forks and longjmp's into the host Gambas program to handle
the request.

That was in the very early days of gb.web.form and it required some hacking
to get it all to work, but I don't remember where problems came up. Maybe
it's simply better these days and you want to try it out?

Regards,
Tobi

[1] http://gambaswiki.org/wiki/doc/webpage

-- 
"There's an old saying: Don't change anything... ever!" -- Mr. Monk

----[ Gambas mailing-list is hosted by https://www.hostsharing.net ]----


More information about the User mailing list