Web server sample

Hello
I found some 25 years old web server sample (attached). I’m wondering, can someone take a look and make something useful? It would be nice to have something simple to serve web pages.
web.zip (48.7 KB)

This might save you/someone a lot of time … https://www.rebex.net/tiny-web-server/

2 Likes

As for a lite web server environment, I recommend Laragon… It’s great!
https laragon dot org
Just removed the link…

Go to Download Clarion Templates and Tools from Icetips Alta LLC and search for “CGI templates”…
There are 2 files for download with a template for serving pages using CGI.
There was another CGI template on the web, but couldn’t find it…

Thank you for Laragon but it looks like WAMP… What I meant is own solution (or some library which works with Clarion) to serve web pages, so I can define what goes back to client (based on client’s request).
With other words, something NetTalk do (I presume, I do not own it) but much simpler.

Yeah, I prefer Laragon over WAMPP or XAMPP. But I’ll give it a try the tini-web-server…
About your question, the OLD way I know is using a Clarion app as CGI on the server… But CGI is really outdated and has performance issues…
The modern (and simple/easy) way I know is using NetTalk to create a WebService… Don’t know better alternatives to NetTalk…
Clarion 10/11 has support to WebSockets, but I don’t know if it is suitable for serving pages…
Sorry I can’t help you. Interested if anyone has another options…

See the discussion at Json webservice on clarion10

Best regards

Try to view this, i can pull it up just fine on my work machine - but not supposed to do this at work, so exit , go to my personal laptop and the antivirus software on chrome goes nuts.

On my computer, Malwarebytes does not like even opening this Clarionhub page with that Laragon link on it. It says there’s “phishing” via that URL and blocks Chrome from loading it.

However, virustotal says everything is fine. Even the MalwareBytes entry on virustotal shows Flavio’s link as fine.

But if I wanted to see it, I’d have to elevate to Admin and specifically allow it.

Strange…
But you can google for laragon to get the url… and download it from GitHub
Laragon is like WAMPP/XAMPP, but with several extras…
You can have and switch from several versions of PHP, MySQL, Node.js, Apache, Python, Nginx.
It cames already with composer, git, HeidiSQL, Cmder, notepad++…
It’s really a Swiss army knife for web development!

1 Like

By just reading the code, I see it can serve pages already made, but there is commented source that give some hints about how to create html pages dynamically…
Next step is compile and put it on the Apache’s cgi-bin folder and try to call it…

Hmmm… This sample uses winsockets, not CGI, for communication.
Don’t know yet how to use it…

What exactly are you trying to do?
What do you mean by “serving web page”?

What do you mean by this?

Do you want to run a Clarion App as a website, is that what you’re asking?

Here is the idea:

  • compiled exe waiting on some port (for example 81) on VPS or dedicated server
  • dedicated server have IP 123.456.789 and once client enter http://123.456.789:81, page which is defined as “default” will be displayed because client send GET request and server send a answer (based on request).
  • if client see on “default” page some button (or link) and under them is something like http://123.456.789:81/index.html?ex1=1&ex2=“abc”, server will receive those parameters and server will send a answer based on that. “Answer” is actually web page, or JSON data, or HTML code, or anything else, because server (actually Clarion code) create that answer.
    On that way, complete webapp can be built, like shopping-cart or CRM or any kind of application. Server can return complete HTML pages with JavaScript, or, you can have “empty” pages and load it with data (like tables, forms etc).
    I understand that Nettalk do all that (and more) but
    a) it cost $1200 with all requirements
    b) it would be nice to have something simple with source :slight_smile:

Maybe have a look at Clarion HandyTools I think they also have a web server and don’t cost as much

1 Like

The problem is that it’s really not that simple.

1 Like

Yeah, so you want a Clarion Web App. :wink:

Next question, why do you want a Clarion Web App? If it’s simple then why not just a standard website that handles requests. (Now it becomes not so simple because you want to manage your data with a Clarion app - yes? :slightly_smiling_face:)

So, there’s Nettalk, Handy Tools, Clarion H5 (dead?) and Clarion AnyScreen - Clarion 11+ needed, plus licencing of server. None of them I would call cheap. (or easy?)

PS: I’m pretty sure both Bruce and Gus, who make Nettalk and Handy Tools respectively, would be pretty up to date with security protocols, which is why I would tend to use those as my first choice if you went down this path.

Maybe you could run a bog standard webserver with your data in a standard mysql database and maintain the data with a web API and a Clarion desktop app using standard web commands included in Clarion 10+. (I have no idea if you need the Enterprise edition for these tools, I’m not sure anyone knows anymore?) This is cheap, in everything except time and expertise.

2 Likes

I can see an interesting use case of apps communication over LAN here at work…
Just have to find how implement the socket communication on the “client” apps…

Obviously, it can work over LAN. On posted example, Winsock is used.

Just for the record, I’d point out that NetTalk is shipped as mostly-source. All the functionality (web server etc) are all classes, and are all source.

The only non-source layer is the wrapper around the winsock library. For historical reasons thats a DLL. We’re activly reducing DLLs, so the time will come when i can shop that as source too.

Also i applaud your interest in this space. Its how i started NetTalk 25 years ago, and we started building web servers with it almost 20 years ago. If you have the time you will learn a lot going this route. And yes it can be done with Clarion since NetTalk is written in Clarion.

You’ll also learn a huge amount about Windows APIs, OpenSSL, multi-threading, cross-thread communications, HTTP protocol, compression, and so much more. At its heart a web server is really simple software, but to be actually useful in a real world, there are quite a lot of bases to cover.

If you have the time though, i encourage it. The learning you will do is immensely valuable.

2 Likes