Android Tutorial Embed an Http Server in your Android Application

Status
Not open for further replies.

thoscho2003

Member
Licensed User
Longtime User
hi Erel

I work with a mobile phone with android 4.0.3, on which is established a mobile hotspot. when I start your server example I get only "Device not connected to local network". In the log appears the ip 127.0.0.1 and the following messages:

** Activity (main) Create, isFirst = true **
Ip address: 127.0.0.1
** Activity (main) Resume **
** Service (serverservice) Create **
2013-12-11 11:01:20.527:INFO::jetty-7.x.y-SNAPSHOT
2013-12-11 11:01:20.641:INFO::started o.e.j.s.ServletContextHandler{/,null}
2013-12-11 11:01:20.648:INFO::Started BlockingChannelConnector@0.0.0.0:5555 STARTING
org.eclipse.jetty.server.Server@416ace60
** Service (serverservice) Start **

what can I do to connect my server to the hotspot and to retrieve the ip-adress?

thanx in advance
 

AndroidUserCCS

Member
Licensed User
Longtime User
Hi Erel Beautiful code and example, I deploy it in my blu dash 4.0 and using your noip library too.

In my router I use a port forwarding from 80 to 8080 (my router use dd-wrt firmware)

Android cannot open the port 80 so I rooted my phone, use Port Forwarded Ultimate I get it from google play store and works!

You can see this in http://pm.zapto.org is the database example posted by you. (is my cellphone connected to wifi lan so can be slow.)

Edit: Now is running under my samsung note 2, if wifi is not available is run under mobile connection. (I want to know if my provider give me access)
 
Last edited:

juanramondroid

New Member
Licensed User
Longtime User
Hi Erel. I'm one question please. There is possible to connect without WIFI, throught the mobile data connection?
 

thoscho2003

Member
Licensed User
Longtime User
The use of the html template is nice to transfer actual status informations. But is there a similar possibility to include a live/preview image into the webpage? Maybe the image is cached in the RAM.
 

thoscho2003

Member
Licensed User
Longtime User
thanx

is it possible to include "prev.jpg" as such a temporary immage file with a html tag in that way:

src= "DirInternalCache/prev.jpg" ?
 

pauleffect

Member
Licensed User
Longtime User
@Erel , the chat app seems very interesting. I was wondering if you could help me get the user name from the service into a variable in Main. I think it's done with callsub (though the exact implementation eludes me).
Would you kindly shed some light on this matter?
Thanks.
PS: i sincerely apologize for my stupid questions. i have an awkward condition that renders docs (mostly) useless to me. so I'm learning by following examples and forum posts. Thanks again!
 

pauleffect

Member
Licensed User
Longtime User
On it!
Thank you!
_________
I thought public var's were declared once and used "as is" throughout the program. This is the first time I bumped into globals and noticed how you used them. I sincerely believe these little pieces of code are 1000x more useful than all the docs anyone could possibly write for b4a combined.
 
Last edited:

EvgenyB4A

Active Member
Licensed User
Longtime User
Hello,
Is it possible that HTTP Server will work at Ethernet network instead of Wifi?
 

DonManfred

Expert
Licensed User
Longtime User
Hello,
Is it possible that HTTP Server will work at Ethernet network instead of Wifi?

If your device is connected to your LAN with LAN-Cable then you can use lan, sure. But your device don´t have an ethernet-plug i suppose... So your device is connected to your lan ONLY over wifi
 

EvgenyB4A

Active Member
Licensed User
Longtime User
If your device is connected to your LAN with LAN-Cable then you can use lan, sure. But your device don´t have an ethernet-plug i suppose... So your device is connected to your lan ONLY over wifi
My device is connected to Lan via Ethernet and the application says that there is no connection. When I use Wifi that there is connection an app shows the IP address. I saw in one of Erel replyes that this app works only with WiFi, but I need that it will work with Ethernet too.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…