Pravee7094
Active Member
Hello All,
Response Error came while run the program. I write a just simple connection program. Here is the code.
This is Php code
Error message I have:
ResponseError. Reason: java.net.SocketTimeoutException: failed to connect to /192.XXX.X.XX (port 8080) from /192.XXX.X.XX (port 36126) after 30000ms, Response:
Anybody Help!
Thanks
Response Error came while run the program. I write a just simple connection program. Here is the code.
B4X:
#Region Project Attributes
#ApplicationLabel: B4A Example
#VersionCode: 1
#VersionName:
'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 = "http://192.xxx.x.xx:8080/loginphp/"
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)
Activity.LoadLayout("login")
TestConnection
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")
ProgressDialogShow("Connecting...")
End Sub
Sub JobDone (Job As HttpJob)
ProgressDialogHide
If Job.Success = True Then
Dim ret As String
ret = Job.GetString
Dim parser As JSONParser
parser.Initialize(ret)
If Job.JobName = "Connect" Then
Dim act As String = parser.NextValue
If act = "ConnectionSuccessful" Then
ToastMessageShow("Connection success", True)
End If
End If
Else
Log("failure")
ToastMessageShow("Error: " & Job.ErrorMessage, True)
End If
Job.Release
End Sub
Sub btnSubmit_Click
End Sub
This is Php code
PHP:
<?php
print json_encode("ConnectionSuccessful");
?>
Error message I have:
ResponseError. Reason: java.net.SocketTimeoutException: failed to connect to /192.XXX.X.XX (port 8080) from /192.XXX.X.XX (port 36126) after 30000ms, Response:
Anybody Help!
Thanks