2017년 8월 11일 금요일

Extension: Simple Web Server


this extension create a Simple Web Server.

Features and Restrictions:

1.- Only can serve one HTML file, this file is in SdCard, example in root SdCard: /mnt/sdcard/index.htm

2.- Also can serve a text

3.- File only with codes HTML, no images, It is posible externals link.
4.- This extension is a service, if you start this server, click back button mobile and run others apps, this server continue run.
5.- To stop this service, Click in Button1 or Button2 again, when stop service app is closed. With this code isn't posible stop service and continue run app. Button1 and Button2, start server and stop  "app & server".
6.- It Works in MIT COMPANION and installed (better installed).
7.- User must write in browser your local WiFi IP and port 8080, example: 192.168.1.5:8080
8.- My index.htm in only an HTML file example, to try copy in root SdCard (/mnt/sdcard/index.htm)
9. You can set a file (/mnt/sdcard/index.htm) and run server. Then close server-app. Run again server-app. Then set other file (/mnt/sdcard/other.htm) and run server again.
10.- Size extension only 13 KB.
--
what exactly is the advantage of using this extension compared to a webviewer component?

--
this is a web server, a web server serve web pages or files to users, in response to theirs requests.

WebViewer is a browser, as Chrome, Firefox,... to read htm pages or others files.

If you run this server in your app, others users from you local net, can read file in your /mnt/sdcard, example: /mnt/sdcard/file.htm

Others local users in theirs browsers in PC, mobile, tablet... can write your local IP, example: 192.168.1.5:8080 and read your page. (umm difficulty with english).

--
Do you need to use Webviewer to see output of the webserver, you didn't show these blocks?

I presume you need a routine to grab the local IP on each use, but won't each device create its own server, or do you simply have one app for the server and another app to access the server from other devices?

--
when you run this extension in your app, you mobile is a local web server. You find you IP, is easy, example when run MIT COMPANION show your local IP. 

Then you say this IP others user, those user in browsers PC, Android, tablet,...example Chrome, Firefox, WebWiever... write your local IP, example 192.168.1.5:8080 and get you file.

If you need static IP number in your mobile, you can set your router. MAC --------> IP.

--
Thanks Juan, it is making sense now :)

--
this version with a new block to get WiFi IP. 

--
(added to FAQ Web Services section) FAQ for Web Services Examples

--
I imagine this server would be useful for local chat without SMS or BlueTooth,
assuming local WiFi.  Clients of the server would need to poll it periodically.

--

I thought in a chat, perhaps if web page refresh in client by HMTL code http-equiv=”refresh” content="15" poll automatic

But principal restriction of this code is: you can't stop server and continue app. Whenever stop server, close app.

--
this is a new version com.KIO4_SimpleWebServer.aix extension, 7/august/2017

Fixed Stop server. Now when Stop server app doesn't close.

- To try example, please download files index.htm and baile.htm and copy in your: /mnt/sdcard/

- This simple web server can serve text but not images, but works with hotlink.

- Hotlinks works in PC browsers, but doesn't work for me in Chrome mobile.

--
hi,it is very good aix,and could you add a event to app,in the event can get the url path,then can analysis the url path to repose different to the client.

--
Thanks MiuMiu, I'll try that.
btw. in this post a chat example by this SimpleWebServer:

--
Thanks for you reply!

Chat with SimpleWebServer is a good idea! and expect you can add event notice to app and respose to request...

--

댓글 2개:

  1. BlueHost is ultimately one of the best web-hosting company for any hosting plans you require.

    답글삭제
  2. Quantum Binary Signals

    Get professional trading signals sent to your cell phone every day.

    Start following our signals right now and make up to 270% a day.

    답글삭제