luke2012 Well-Known Member Licensed User Longtime User Nov 11, 2016 #1 Hi all, how to check if a web server is up with HttpUtils2 ? For example: I'm using a server url like "http://192.168.x.x:51042"
Hi all, how to check if a web server is up with HttpUtils2 ? For example: I'm using a server url like "http://192.168.x.x:51042"
S sorex Expert Licensed User Longtime User Nov 11, 2016 #2 a regular download job would do Code: Copy Dim dlj As HttpJob dlj.Initialize("dlj",Me) dlj.Download("http://192.168.x.x:51042") Sub jobdone(job As HttpJob) Try If job.Success Then else end if Catch Log(LastException) End Try job.Release End Sub Edit: this is the okHTTP method which should be used since the other one is outdated. Upvote 0
a regular download job would do Code: Copy Dim dlj As HttpJob dlj.Initialize("dlj",Me) dlj.Download("http://192.168.x.x:51042") Sub jobdone(job As HttpJob) Try If job.Success Then else end if Catch Log(LastException) End Try job.Release End Sub Edit: this is the okHTTP method which should be used since the other one is outdated.
KMatle Expert Licensed User Longtime User Nov 11, 2016 #3 Additional: Use the timeout parameter (if the server is "down", HttpUtils will wait 30 secs which is a bit long) Code: Copy dlj.GetRequest.Timeout=2000 '2 Secs Upvote 0
Additional: Use the timeout parameter (if the server is "down", HttpUtils will wait 30 secs which is a bit long) Code: Copy dlj.GetRequest.Timeout=2000 '2 Secs
Erel B4X founder Staff member Licensed User Longtime User Nov 13, 2016 #4 Note that you don't need to catch any error in JobDone. Just check whether Job.Success is true or not. Upvote 0
Note that you don't need to catch any error in JobDone. Just check whether Job.Success is true or not.