How to Run Web Standalone App?

Hello Everyone,

The Raspberry Pi 2 B is great and I am having lots of fun with making projects on it. I am sure that I am missing something simple, and how do I run a standalone Web app on Raspberry Pi?

I created a simple ‘Hello World’ web app with a label that said 'Hello World" and added the following into the App Open event.

#If Not DebugBuild Then If Not App.Daemonize Then //MsgBox “Unable to Daemonize app.” Quit End If #Endif

The Linux build settings were set to ARM 32-bit and I built the program. The executable and library files were then copied to the Raspberry Pi. Here are the commands that I used in the directory where the HelloWorld program is stored:

chmod +x HelloWorld sudo ./HelloWorld --port=8080

Then I typed the following in the browser and the

http://127.0.0.1:8080 http://localhost:8080 http://10.0.1.45:8080

There were no errors when the commands were executed, and the browser shows “Loading 127.0.0.1 …” at the bottom of the screen, and after many minutes there is no change, still loading 127.0.0.1 …

Any thoughts on what I could be doing wrong? Thanks for your help.

Don’t daemonize when launching from the command line or use start-stop-daemon to control daemons.

Here’s an example:

sudo start-stop-daemon --start --exec ./HelloWorld -- --port=8080

Thanks for the help Frederick, and I seem to be missing something.

The program does not need to be a daemon, LOL, I am just trying to run a simple web program and thought that it had to be daemonized to run (I was probably reading too many items in the Xojo forum) :slight_smile: Sorry for the confusion of my request.

I can’t seem to get the program to show in the browser on Raspberry Pi with the non-daemon program. Here is the command that I used to try and run the Xojo Web program.

./HelloWorld --port=8080

When I list the running processes with ps -ef, the ./HelloWorld program is shown in the list. Just in-case I messed something up in the OS, I reinstalled Raspbian Jessie and the Web program is running but the browser shows ‘loading 127.0.0.1…’.

Here is a download link for the HelloWorld program: Hello World Download

What else should I try? Thanks for your help Frederick!

You might also try running netstat to see if there are any other apps listening on port 8080, although I’d expect your web app to quit immediately in that case.

Just downloaded and examined your project. Change the Deployment Type from CGI to Stand Alone in the Inspector when Shared is selected under Build Settings in the Navigator.

After the suggested change to the project and compiling with 2015r4, it runs on Raspbian Jessie and works as expected in Web.

Launched it in Terminal with:

sudo ./HelloWorld --port=8080

Loaded it in Web with:

localhost:8080

Eugene Blushing, Ok, now that was embarrassing … I made the change, recompiled the Stand Alone program, and still getting the ‘loading 127.0.0.1…’ message on the browser.

I ran netstat and did not see any other programs using this port. Just for the fun of it I ran it on port 8081 and it worked … YAY!!!

Thanks to the two of you for suggesting the Stand Alone setting and the different port.

If your pi has been running all this time, you may have another instance of your app still running on port 8080.

This was very possible. I used the following command to check for programs on port 8080 and didn’t find a program running:

sudo netstat -plnt|grep ":8080"

To your knowledge, is there a program(s) that commonly uses 8080? I am just thinking out-loud about using the Pi as an atmospheric pressure recorder and if this is a commonly used port then I’ll aim to use a port that is less common and is usually always open.

I have seen 8080 used by other vendors, but nothing specific. It might be better to use a config file which you read from App.Open. If you add or replace arguments there, they’ll get used instead of what is on the command line.

Very good. Thanks for the helpful information Greg!

If you have Oracle get started installed, that uses port 8080 as it’s standard.