Alberto Michelis Well-Known Member Licensed User Longtime User Feb 10, 2017 #1 Hi, How to set the timeout when using OkHttpUtils2 lib? I serach the forum and try Dim HttpJob1 As HttpJob HttpJob1.download(URL) HttpJob1.GetRequest..... but theres no timeout Thanks
Hi, How to set the timeout when using OkHttpUtils2 lib? I serach the forum and try Dim HttpJob1 As HttpJob HttpJob1.download(URL) HttpJob1.GetRequest..... but theres no timeout Thanks
DonManfred Expert Licensed User Longtime User Feb 10, 2017 #2 If i remember correctly you need to add okhttp lib TOO for this Upvote 0
DonManfred Expert Licensed User Longtime User Feb 10, 2017 #4 if i add okhttputils2 AND okhttp it works for me. Code: Copy Dim httpPayment As HttpJob httpPayment.Initialize("httpPayment", Me) httpPayment.Download2("https://abc.com/xyz.asp","") httpPayment.GetRequest.Timeout = 60000 Upvote 0
if i add okhttputils2 AND okhttp it works for me. Code: Copy Dim httpPayment As HttpJob httpPayment.Initialize("httpPayment", Me) httpPayment.Download2("https://abc.com/xyz.asp","") httpPayment.GetRequest.Timeout = 60000
Alberto Michelis Well-Known Member Licensed User Longtime User Feb 10, 2017 #5 No way, using download or download2 theres no getrequest.timeout, see image Attachments 2017-02-10_2052.png 4.4 KB · Views: 614 Upvote 0
Alberto Michelis Well-Known Member Licensed User Longtime User Feb 11, 2017 #7 OK, thanks, I did it and set the timeout to: httpPayment.GetRequest.Timeout = 5000 (5 secs) but when reading it is still in 30 secs Any idea? Upvote 0
OK, thanks, I did it and set the timeout to: httpPayment.GetRequest.Timeout = 5000 (5 secs) but when reading it is still in 30 secs Any idea?
KMatle Expert Licensed User Longtime User Feb 11, 2017 #8 Never read it after. But it works. Use a local address like 192.168.1.x (e.g. your pc) and try. Upvote 0
DonManfred Expert Licensed User Longtime User Feb 11, 2017 #9 Alberto Michelis said: Any idea? Click to expand... Make sure to set the Timeout AFTER the call to Download, Download2, Poststring, Whatever.... See Post #4 Upvote 0
Alberto Michelis said: Any idea? Click to expand... Make sure to set the Timeout AFTER the call to Download, Download2, Poststring, Whatever.... See Post #4
KMatle Expert Licensed User Longtime User Feb 11, 2017 #10 DonManfred said: Make sure to set the Timeout AFTER Click to expand... Right. I use it that way but did not think of it Upvote 0
DonManfred said: Make sure to set the Timeout AFTER Click to expand... Right. I use it that way but did not think of it
Alberto Michelis Well-Known Member Licensed User Longtime User Feb 11, 2017 #11 I use it that way but the timeout does not change. Upvote 0
KMatle Expert Licensed User Longtime User Feb 11, 2017 #12 Alberto Michelis said: but the timeout does not change Click to expand... How do you measure it? My call which works: Code: Copy Dim GetItemsJob As HttpJob GetItemsJob.Initialize("GetItems", Me) GetItemsJob.PostString(ServerAddress & "/xxxx/xxxxx.php", JSONstring) GetItemsJob.GetRequest.Timeout=3000 '3 secs Upvote 0
Alberto Michelis said: but the timeout does not change Click to expand... How do you measure it? My call which works: Code: Copy Dim GetItemsJob As HttpJob GetItemsJob.Initialize("GetItems", Me) GetItemsJob.PostString(ServerAddress & "/xxxx/xxxxx.php", JSONstring) GetItemsJob.GetRequest.Timeout=3000 '3 secs
M Marc De Loose Member Licensed User Longtime User Aug 23, 2017 #13 Im running into somewhat of the same problem. It somehow goes back to the 30 second default. I can easely test it. I unplug the internet connection from my router. I activate the service. It works I keep trying and after a while it is again timing out in 30 seconds. Plug it back in And it goes back to the timeout I set. Any ideas? (I am running httpjob in a service that checks for an intent to fire some homeautomation stuff.) Upvote 0
Im running into somewhat of the same problem. It somehow goes back to the 30 second default. I can easely test it. I unplug the internet connection from my router. I activate the service. It works I keep trying and after a while it is again timing out in 30 seconds. Plug it back in And it goes back to the timeout I set. Any ideas? (I am running httpjob in a service that checks for an intent to fire some homeautomation stuff.)
KMatle Expert Licensed User Longtime User Aug 23, 2017 #14 There are 2 scenarious: 1. The ip address is not available (= server does not respond) 2. The internet connection is not avilable (= unplug the router) I assume only the timeout for the request ittself (#1) can be changed, not for the internet connection (maybe android waits 30 secs for the connection to be available) Upvote 0
There are 2 scenarious: 1. The ip address is not available (= server does not respond) 2. The internet connection is not avilable (= unplug the router) I assume only the timeout for the request ittself (#1) can be changed, not for the internet connection (maybe android waits 30 secs for the connection to be available)