I am using my application to extract sms messages stored on my phone into a List and using the list.size to loop and submit the sms details over InitializePost2 to a webservice I have written in PHP. PHP then stores the SMS data in a table.
This works fine but stops sending the data after about 5 records. I am attributing this to timeout associated with HTTPRequest as per the documentation.
Can someone help me on how to post all my records to the webservice over InitializePost2 without having timeout. I need to increase the timeout.
=================================================
HttpRequest
Holds the target URL and other data sent to the web server.
The initial time out is to 30000 milliseconds (30 seconds).
Code Below
=========
Sub Activity_Create(FirstTime As Boolean)
If FirstTime Then
hc.Initialize("hc")
End If
Dim SmsMessages1 As SmsMessages
Dim List1 As List
Dim address,xaddress, xbody, smsread, smsdate,smstime,msgid As String
List1 = SmsMessages1.GetAllSince(DateTime.Add(DateTime.Now, 0, 0, -2))
For i = 0 To List1.Size - 1
Dim Sms As Sms
Sms = List1.Get(i)
address = Sms.address
xaddress = address.Trim
xbody = "No-Data"
smsread = Sms.Read
smsdate = DateTime.date(Sms.date)
smstime = DateTime.Time(Sms.date)
msgid = Sms.Id
ExecuteRemoteQuery("http://192.188.1.100:10088/smslogger/smslogger.php?xaddress="&xaddress&"&xbody="&xbody&"&smsread="&smsread&"&smsdate="&smsdate&"&smstime="&smstime&"&msgid="&msgid,1)
Next
End Sub
Sub Wait(Sekunden As Int)
Dim Ti As Long
Ti = DateTime.Now + (Sekunden * 10000)
Do While DateTime.Now < Ti
DoEvents
Loop
End Sub
Sub ExecuteRemoteQuery(Query As String, TaskId As Int)
Dim req As HttpRequest
req.InitializePost2(Query, Query.GetBytes("UTF8"))
hc.Execute(req, TaskId)
ProgressDialogShow("Processing Data")
ToastMessageShow(Query,True)
'Msgbox(Query,True)
Wait(1)
End Sub
This works fine but stops sending the data after about 5 records. I am attributing this to timeout associated with HTTPRequest as per the documentation.
Can someone help me on how to post all my records to the webservice over InitializePost2 without having timeout. I need to increase the timeout.
=================================================
HttpRequest
Holds the target URL and other data sent to the web server.
The initial time out is to 30000 milliseconds (30 seconds).
Code Below
=========
Sub Activity_Create(FirstTime As Boolean)
If FirstTime Then
hc.Initialize("hc")
End If
Dim SmsMessages1 As SmsMessages
Dim List1 As List
Dim address,xaddress, xbody, smsread, smsdate,smstime,msgid As String
List1 = SmsMessages1.GetAllSince(DateTime.Add(DateTime.Now, 0, 0, -2))
For i = 0 To List1.Size - 1
Dim Sms As Sms
Sms = List1.Get(i)
address = Sms.address
xaddress = address.Trim
xbody = "No-Data"
smsread = Sms.Read
smsdate = DateTime.date(Sms.date)
smstime = DateTime.Time(Sms.date)
msgid = Sms.Id
ExecuteRemoteQuery("http://192.188.1.100:10088/smslogger/smslogger.php?xaddress="&xaddress&"&xbody="&xbody&"&smsread="&smsread&"&smsdate="&smsdate&"&smstime="&smstime&"&msgid="&msgid,1)
Next
End Sub
Sub Wait(Sekunden As Int)
Dim Ti As Long
Ti = DateTime.Now + (Sekunden * 10000)
Do While DateTime.Now < Ti
DoEvents
Loop
End Sub
Sub ExecuteRemoteQuery(Query As String, TaskId As Int)
Dim req As HttpRequest
req.InitializePost2(Query, Query.GetBytes("UTF8"))
hc.Execute(req, TaskId)
ProgressDialogShow("Processing Data")
ToastMessageShow(Query,True)
'Msgbox(Query,True)
Wait(1)
End Sub
Last edited: