Hi everybody,
I'm facing a problem with my connection. My app works fine, but suddenly, it starts with intermittent timeout using PostString after a couple minutes. My app executes a sp every 7 seconds, I'm not sure if this is the cause of my problem, if so, how can I fix it ?
I'm only using WIFI with 2 devices Galaxy Tab 7 & Galaxy S 3. I don't think that my server has any problem.
These are 2 errores that my app is showing:
error: org.apache.http.conn
ConnetTimeoutException: Connect to timed out
error: org.apache.http
NoHttpResponseexception: The target serverfailed to respond Job.
Need help
This is my relevant code:
I'm facing a problem with my connection. My app works fine, but suddenly, it starts with intermittent timeout using PostString after a couple minutes. My app executes a sp every 7 seconds, I'm not sure if this is the cause of my problem, if so, how can I fix it ?
I'm only using WIFI with 2 devices Galaxy Tab 7 & Galaxy S 3. I don't think that my server has any problem.
These are 2 errores that my app is showing:
error: org.apache.http.conn
ConnetTimeoutException: Connect to timed out
error: org.apache.http
NoHttpResponseexception: The target serverfailed to respond Job.
Need help
This is my relevant code:
B4X:
Sub Process_Globals
Dim timer2 As Timer
Private GET_MESSAGES = "get_messages" As String
End Sub
Sub Globals
Dim SPResult As List
End Sub
Sub Activity_Create(FirstTime As Boolean)
timer2.Initialize("timer2",7000)
timer2.Enabled=true
end sub
Sub JobDone(Job As HttpJob)
ProgressDialogHide
If Job.Success Then
Dim res As String
res = Job.GetString
Log("Response from server: " & res)
Dim parser As JSONParser
parser.Initialize(res)
Select Job.JobName
Case GET_MESSAGES
SPResult = parser.NextArray 'returns a list with maps
For i = 0 To SPResult.Size - 1
Dim M As Map
M = SPResult.get(i)
If M.get("id") < 0 Then
ToastMessageShow("xxx", True)
End If
next
End Select
Else
ToastMessageShow("Error: " & Job.ErrorMessage & " Job.JobName=" & Job.JobName, True)
End If
Job.Release
end Sub
Sub ExecuteRemoteQuery(Query As String, JobName As String)
Dim job As HttpJob
job.Initialize(JobName, Me)
job.PostString("http://www.mywebsite.com/myquery.php", Query)
End Sub
Sub GetMessages
ExecuteRemoteQuery("CALL ListMessages", GET_MESSAGES)
End Sub
Sub timer2_Tick
GetMessages
End Sub
Last edited: