Android Question Response Error while connecting with okhttputils2


Active Member
Hello All,

Response Error came while run the program. I write a just simple connection program. Here is the code.
#Region  Project Attributes
    #ApplicationLabel: B4A Example
    #VersionCode: 1
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: unspecified
    #CanInstallToExternalStorage: False
#End Region

#Region  Activity Attributes
    #FullScreen: True
    #IncludeTitle: False
#End Region

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
    Private xui As XUI
    Dim strURL As String = ""
End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    Private lblUsername As Label
    Private lblPassword As Label
    Private edtUsername As EditText
    Private edtPassword As EditText
    Private btnSubmit As Button
End Sub

Sub Activity_Create(FirstTime As Boolean)
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub TestConnection
Dim Connect As HttpJob
    Connect.Initialize("Connect", Me)
    Connect.Download(strURL & "connection.php")
End Sub

Sub JobDone (Job As HttpJob)
    If Job.Success = True Then
        Dim ret As String
        ret = Job.GetString
        Dim parser As JSONParser
        If Job.JobName = "Connect" Then
            Dim act As String = parser.NextValue
            If act = "ConnectionSuccessful" Then
                ToastMessageShow("Connection success", True)
            End If
        End If
        ToastMessageShow("Error: " & Job.ErrorMessage, True)
    End If
End Sub

Sub btnSubmit_Click
End Sub

This is Php code
    print json_encode("ConnectionSuccessful");

Error message I have:

ResponseError. Reason: failed to connect to /192.XXX.X.XX (port 8080) from /192.XXX.X.XX (port 36126) after 30000ms, Response:

Anybody Help!



Active Member
You should learn how to use Wait For:

Make sure that the relevant port it open in Windows firewall.
Hello sir,

I saw that video above you mentioned. Thats greatful. But still I have a doubt.

I run the codings in local server. The question is, How the PHP code is running? For example when we work with JRDC2, we have a B4J project, so thats run on the server side.
But When we work with php and mysql using okhttputils2 how the process is going? How the php file running on server side?

Any suggestions

Upvote 0