I ran a jRDC via command prompt on Windows. The Operation on server is OK (see the attached picture)
but on Android device, got TimeOut Error Connection.
These are the codes for those commands
B4X:
Sub Test
Dim cmd As DBCommand
cmd.Initialize
cmd.Name = "del_bi_tbl"
wait for (reqM.ExecuteCommand(cmd,"del_bi_tbl")) JobDone (job As HttpJob)
If job.success Then
Dim cmd As DBCommand
cmd.Initialize
cmd.Name = "ins_bi_tbl1"
cmd.Parameters = Array As Object("01/01/2019","31/03/2019")
reqM.ExecuteCommand(cmd, "ins_bi_tbl1")
Dim cmd As DBCommand
cmd.Initialize
cmd.Name = "ins_bi_tbl2"
cmd.Parameters = Array As Object("01/04/2019","30/06/2019")
reqM.ExecuteCommand(cmd, "ins_bi_tbl2")
End If
End Sub
Sub JobDone(Job As HttpJob)
If Job.Success = False Then
log(Job.ErrorMessage)
Else
Dim result As DBResult = reqM.HandleJob(Job)
Log(result.Tag)
End If
End Sub
Internet Connection is OK. I have already set j.GetRequest.Timeout = 300000
Any hints, how to handle this problem?
Sub Test
Dim cmd As DBCommand
cmd.Initialize
cmd.Name = "del_bi_tbl"
wait for (reqM.ExecuteCommand(cmd,"del_bi_tbl")) JobDone (job As HttpJob)
If job.success Then
job.release
Dim cmd As DBCommand
cmd.Initialize
cmd.Name = "ins_bi_tbl1"
cmd.Parameters = Array As Object("01/01/2019","30/06/2019")
wait for (reqM.ExecuteCommand(cmd,"ins_bi_tbl1")) JobDone (job As HttpJob)
If job.success Then
job.release
else
log(Job.ErrorMessage)
job.release
end if
else
job.release
End If
End Sub
Although on Server the operation is OK, but on Android device, still got TimeoutError.
The operation on server took about 120 seconds to finished.
It seem that operation on server that took more than 60 seconds mostly will give TimeOutError to client.
I have set TimeOut to 600K and change codes into like these
B4X:
Sub Test
THREADS = 12
ProgressDialogShow2("Please wait ...")
Dim req As DBRequestManager = CreateRequest
Dim cmd As DBCommand = CreateCommand("del_bi_tbl", Null)
wait for (req.ExecuteCommand(cmd,"del_bi_tbl")) JobDone (job As HttpJob)
If job.success Then
Private Yr,RptDt1,RptDt2 As String
Yr = DateTime.GetYear(DateTime.Now)-2000
For i = 1 To 12
If i = 1 Then
RptDt1 = "01/01/" & Yr
RptDt2 = "31/01/" & Yr
else if i = 2 Then
RptDt1 = "01/02/" & Yr
RptDt2 = "28/02/" & Yr
else if i = 3 Then
RptDt1 = "01/03/" & Yr
RptDt2 = "31/03/" & Yr
else if i = 4 Then
RptDt1 = "01/04/" & Yr
RptDt2 = "30/04/" & Yr
else if i = 5 Then
RptDt1 = "01/05/" & Yr
RptDt2 = "31/05/" & Yr
else if i = 6 Then
RptDt1 = "01/06/" & Yr
RptDt2 = "30/06/" & Yr
else if i = 7 Then
RptDt1 = "01/07/" & Yr
RptDt2 = "31/07/" & Yr
else if i = 8 Then
RptDt1 = "01/08/" & Yr
RptDt2 = "31/08/" & Yr
else if i = 9 Then
RptDt1 = "01/09/" & Yr
RptDt2 = "30/09/" & Yr
else if i = 10 Then
RptDt1 = "01/10/" & Yr
RptDt2 = "31/10/" & Yr
else if i = 11 Then
RptDt1 = "01/11/" & Yr
RptDt2 = "30/11/" & Yr
else if i = 12 Then
RptDt1 = "01/12/" & Yr
RptDt2 = Utility.Str2Dt("31/12/" & Yr)
End If
Dim req As DBRequestManager = CreateRequest
Dim cmd As DBCommand = CreateCommand("ins_bi_tbl", Array (RptDt1,RptDt2))
req.ExecuteCommand(cmd, "ins_bi_tbl" & i)
Next
End If
job.Release
End Sub
Sub JobDone(Job As HttpJob)
If Job.Success = False Then
ProgressDialogHide
Log(Job.ErrorMessage)
Else
Dim result As DBResult = reqM.HandleJob(Job)
Log(result.Tag)
Log("Threads : " & THREADS)
THREADS = THREADS - 1
If THREADS = 0 Then
Log("Ins finished")
ProgressDialogHide
Log(DateTime.Time(DateTime.Now))
End If
End If
End Sub
Still Error. Seem that server will stop to give response to client for every operation that takes more than 90 secs
There are all kinds of timeouts and making queries that take 90 seconds is probably not the best idea. You can switch to WebSockets for such slow tasks.
If there is no error in the server logs then the timeout didn't happen on the server.
1. It is always a good idea to follow the recommended pattern, especially if the developer insists that is is important
2. You will have problems when multiple responses arrive more or less together.