Android Question B4AServer connection problems on local WiFi


Licensed User
Longtime User
Can anyone help me configure my B4AServer files as I cannot seem to get it to work. My understanding of it is a bit sketchy at best so any help would be appreciated
My hardware set up is as follows:
I have a desktop PC running Windows 98. It is stand-alone. I have full adminisrator rights to it. It has a bluetooth dongle but does not have an internal wireless board.
The ony thing connected to the PC's network ports is a DLink DIR-615 wireless router (it became available when Vigin Media upgraded me to a new faster WiFi router)
The PC is not connected to the internet
The PC System Name is 'ETHOS'
The PC workgroup is 'Ethos_COntroller'
The PC network adaptor has been set to an ip address of SubnetMask
The files from the tutorial are in the directory
C:\PDA\60Android\B4AServer (it is network sharable)
The files in this directory are
The WiFi router has been set to the ip address of
The router is not connected to the internet
the name of the wifi router SSID (the name seen when scanning for wifi networks) is 'Kintara_At_Home'
My mobile device (Sony Xperia SP) is connected to a laptop via USB. The laptop only has wifi capability.
I have loaded the B4AServer_Device file to the laptop and opened B4AServer.B4a in Basic4Android.
In the B4A Main module I have:
Sub Process_Globals
Dim ServerName As String
Dim ServerName = "test1"
End Sub
Sun Activity_Create(FirstTime As Boolean)
B4AServer.Initialize("http://192.168.101/PDA/60Android/B4AServer/b4aserver.php", ServerName, "test1")
Using the 3rd party app 'ES FIle Explorer' on the mobile I can see the Files on the PC from the mobile (so I don’t think there is a firewall issue)

run.bat has the line:-
jave -cp b4aserver.jar anywheresoftware.b4a.b4aserver.Server
pause has the line:-
#link to the board server

Does the b4a_server.php file need to be edited? If so, what should be changed?
When I run 'run.bat' on the PC it says:
C\PDA\60Android\B4A Server>java -cp b4aserver.jar anywheresoftware.b4a.b4aserver.Server
B4A server <v0.92> is started. Checking URL:, servername=test1

I cannot get the b4AServer to communicate between the mobile and the PC so I think it must be a configuration issue.
There was some mention of a MySQL database. If I am only using a local wifi network (no internet) do I need this file?
I downloaded a sample MySql file from the internet and renamed it ‘Kintara_ServerDataBase.sql’ and put it in the ‘C\PDA\60Android\B4A Server’ directory on the desktop PC.
I changed the ‘b4a_server.php’ file and changed the following line:-

$databasehost = "localhost";
$databasename = "Kintara_ServerDataBase.sql ";
$databaseusername ="xxxx";
$databasepassword = "xxxx";

Having done all this I still get this on the device log when I press the middle button (Recieve file):-

‘Server not connected. Contacting board web service.’
Then after a short while :
‘Error connecting: Gateway Time-out
Connected = false’

I must admit that I am not that savvy with some of the terms like DCHP, board web server, sockets, and ports and port forwarding but I thought I had done enough to get it working.
Can anyone help me to see where I am going wrong?


Now I get the Log message when I press the middle button (Recieve file)

‘Server not connected. Contacting board web service.
Error Connecting: org.apache.conn.HttpHostConnectException: Connection to refused'
Last edited:


Licensed User
Longtime User
No I have not loaded WAMP on the PC. I dont even know what WAMP is or why i should need it, but thats what Google is for. Thanks, Ill take a look.

Not sure I need to add WAMP as I have not seen it mentioned anywhere else in the B4AServer documentation. Having looked at the WAMP webpage I am none the wiser as I dont understand what JSON or Websockets are etc.
Im sure my connection problems is to do with my configuration settings, but Ill look at installing WAMP anyway.
Last edited:
Upvote 0


Licensed User
Longtime User
Having looked into it it seems I have to have a PHP engine and Apache installed on the Desktop PC.
More to this B4AServer than first meet the eye.

And As Erel has mentioned, WAMP would do the job
(WAMP stands for Windows Apache MySQL and PHP)

And I also have to install:-
Visual C++ 2010 SP1 Redistributable Package x86

What a merry dance!!
Last edited:
Upvote 0

Richard van der Wath

Licensed User
Longtime User
I use php a lot now thanks to this forums. Personally I prefer XAMPP which has similar features.

Many thanks to Erel, Klaus, NJDude, Barx and a tonne more.
Upvote 0


Licensed User
Longtime User
Thank you kindly Sirs,
On the Desktop PC I have C++ installed and running (I think) and XAMPP installed and running. XAMPP control panel shows Apache and MySQL is running.
Now I need to have some time to set up the Mobile/Laptop development bit and try to configure it all to get it working.

## I have no real idea what i am doing; I'm just in the supermarket putting things in the trolly with no real idea of how to cook them!
Upvote 0


Licensed User
Longtime User
But how can I make an android app with b4j, which runs without external libs etc on any android?
Or do you mean, use RDC and B4J for the server app and B4a for the android app?
Upvote 0