Android Question Building your own Local Server with XAMPP and b4A(using MYSQL Database)

beelze69

Active Member
Licensed User
Hi All,

I went through KMantle's tutorial on Using XAMPP with b4A which pulls Mysql data onto android mobile application.

https://www.b4x.com/android/forum/t...-local-php-mysql-server-xampp-with-b4a.48635/

I have a small question.

How will my application residing on the Mobile Device talk to the XAMPP Server on my PC ?

Because:

i) My mobile device is not connected to my PC via any LAN Cable.
ii) My PC uses broadband from a private internet service provider X . My service provider automatically changes IP every M Minutes (they say).

iii) My mobile device uses some other private mobile service provider Y. And X and Y are totally different entities.


So, my doubts are:

i) In the above scenario, how do I test KMantle's application with XAMPP Server and database on my Home PC ?

ii) Can I get access to any free hosting sites where they also 'allow' for MySQL database hosting with 'Mobile Device access' for free (I checked one free site and spent almost 2-3 hours creating a sample MYSQL database on their site but was disappointed to learn later that they do not allow for 'Mobile accessibility' on their free versions)

iii) In PCs(standalone or in a LOCAL LAN/WAN network) we type 'ping localhost' or 'ping <IP ADDRESS>' in the command prompt and we get the ping status. Now, how do we 'ping' like this in a mobile device ?.. Are there any utility available where I can Ping an IP from a mobile device and get a response ?

Thanks in advance.

Sorry, if I sound too basic.
 
Last edited:

beelze69

Active Member
Licensed User
Hi !

I am getting the following error message
<code>
Error: org.apache.http.conn.HttpHostConnectException:connection to http://<ip address>/refused
<code>

I have a wifi router connected to the Internet..

Ps. help

Thanks
 

DonManfred

Expert
Licensed User
I am getting the following error message
<code>
Error: org.apache.http.conn.HttpHostConnectException:connection to http://<ip address>/refused
<code>
Change the Address
"http://<ip address>"

replace <ip address> with your IP-Address
 
Last edited:

beelze69

Active Member
Licensed User
Change the Address
"http://<ip address>"

Hi !

I have an IP address for example 192.168.0.100 ..i.e. when I start my WIFI for a session, I check my current IP address with 'ipconfig' command and immediately put that IP in my b4a source, compile and burn it and run (since I am doing only for testing purposes)... For example, if in my current session, my IP address is 192.168.0.100 then I put that IP address in the b4a Source, compile and burn .. but on execution, it is giving the above error message.

Ps guide me..

Thanks ..
 

DonManfred

Expert
Licensed User
addresses like 192.168.0.100 only works if you are in the same network (wifi for ex).
It does NEVER work if your device is using a internetnetprovider.

Open https://www.wieistmeineip.de/ on your PC browser.

The ip shown is your PCs WAN IP. This is the IP you should use.

Make sure to open the port in your firewall/router
 

beelze69

Active Member
Licensed User
Hi,

Thanks for taking out time to reply to my query.

1) When I start my wifi and check the IP address, the IP address on my mobile shows 192.168.0.107.. Now the IP address on my Server (I agree it is Internal as per your statement) is 192.168.0.100. Now I am able to ping my Mobile IP from my Server i.e. I am able to successfully ping 192.168.0.107 from my server having ip 192.168.0.100.. That means technically, my mobile is on my 'internal' network.. Then why this is not working ? ...

2) I checked my IP address with the link https://www.wieistmeineip.de/ and did a plain http://<WAN IP ADDRESS retuned by your link> /dashboard/phpinfo.php and even that was not displaying ! However, http://192.168.0.100 (my internal lan ip)/dashboard/phpinfo.php works fine.

You have mentioned about opening the port on the firewall/router. I have a TP-LINK router.
and I use Windows 7 32-bit operating system.

a) Which port do I have to open on the Firewall and Router ?
b) How to open that port on the Firewall and Router ?

3) Regarding executing the program, nothing happens when I press the 'Insert' button. When I click on 'Get' -> which translates in the php code in the example to 'select name,age from persons', I get the following error '..main_jobdone(B4A line:112) ListOfPersons= parser nextArray 'returns a java.lang.RuntimeException.JSON Array expected continue ? (Y/N)... Both Y or N does not return anything!..

Ps. help.

Thanks in advance,

Sorry if I sound too basic..
 
Last edited:
Top