Need help with HTTP problems

Medics

New Member
Licensed User
Hi all!

I am new with Basic4ppc and I need help using HTTP requests. :sign0104:

I use a timer to transfer data periodically to a webserver.
B4X:
Sub Timer1_Tick
   URL="http://myserver.com/senddata.php&data=" & data
   WebResponse.New1
   WebRequest.New1(URL)
   WebResponse.Value = WebRequest.GetResponse
   WebResponse.Close
End Sub

The problem is when the phone looses connection I get an error message:
An error occurred on sub __main_timer1_tick.
Response Code: -1
Timeout
Continue?
Yes / No

I am searching for a solution to handle or ignore timeouts.
My HTTP.DLL is version 1.5

Someone can help me please?

Christian
 

Byak@

Active Member
Licensed User
you can do
Sub Timer1_Tick
errorlabel(resperr)
URL="http://myserver.com/senddata.php&data=" & data
WebResponse.New1
WebRequest.New1(URL)
WebRequest.timeout=60000
WebResponse.Value = WebRequest.GetResponse
resperr:
WebResponse.Close
End Sub
 
Top