Android Question Small Tip if RDC isnt working

persianpowerman1

Active Member
Licensed User
Longtime User
hey guys RDC was giving me problem...
I kept getting this error...

Error: org.apache.http.conn.HttpHostConnectException: Connection to http://127.0.0.1:3306 refused

SO i looked it up and look what i found...
From the emulator, il you want to access your physical computer, you must use the following IP address :
10.0.2.2
The one you used, 127.0.0.1, points to the machine inside which your code is executed -- i.e. the emulator itself.
As you don't have an HTTP server running on your Android emulator, your application cannot connect to it -- which explains the error message you get.

So i changed that first part.. and it worked like a charm..
B4X:
Sub Activity_Create(FirstTime As Boolean)
    If FirstTime Then
        reqManager.Initialize( Me , "http://10.0.2.2:3306")
    End If
End Sub

I never found this in the tutorial.. so if anyone with further experience knows why this shouldnt be done ... pls let me know :)
 
Top