Output of example usage code provided below:
==================================================
URL : https://www.google.com
Page Size : 13025
Duration : 281
URL : https://www.yahoo.com
Page Size : 323662
Duration : 1844
URL : https://news.google.com
Page Size : 540853
Duration : 718
JavaObject_InvokeMethod exception: org.apache.http.conn.HttpHostConnectException: Connection to https://abcnews.com refused
JavaObject_InvokeMethod exception: org.apache.http.conn.HttpHostConnectException: Connection to https://cbs.com refused
JavaObject_InvokeMethod exception: javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated
URL : http://www.google.com
Page Size : 13023
Duration : 156
URL : http://www.yahoo.com
Page Size : 322442
Duration : 1422
URL : http://news.google.com
Page Size : 532204
Duration : 328
URL : http://abcnews.com
Page Size : 101077
Duration : 500
URL : http://cbs.com
Page Size : 81984
Duration : 687
URL : http://nbc.com
Page Size : 50498
Duration : 516
==================================================
Fastest : http://www.google.com (156)
Slowest : https://www.yahoo.com (1844)
==================================================
Code that produced above output:
Assoc retVal
String url
Integer start, duration
Assoc fastest
Assoc slowest
List urls = { \
"https://www.google.com", "https://www.yahoo.com", "https://news.google.com", \
"https://abcnews.com" , "https://cbs.com" , "https://nbc.com",\
"http://www.google.com" , "http://www.yahoo.com" , "http://news.google.com", \
"http://abcnews.com" , "http://cbs.com" , "http://nbc.com"}
fastest = Assoc.CreateAssoc()
fastest.Duration = 999999999
fastest.Url = Undefined
slowest = Assoc.CreateAssoc()
slowest.Duration = 0
slowest.Url = Undefined
echo('')
echo('')
echo('')
echo('')
echo(Str.Set(50, "="))
for url in urls
start = Date.Tick()
retVal = $aaamod.Utils.HttpGet(url)
duration = Date.Tick() - start
if (retVal.Ok)
echo("URL : ", retVal.Url)
echo("Page Size : ", Length(retVal.Data))
echo("Duration : ", duration)
if (fastest.Duration > duration)
fastest.Duration = duration
fastest.Url = url
end
if (slowest.Duration < duration)
slowest.Duration = duration
slowest.Url = url
end
end
end
echo(Str.Set(50, "="))
echo("Fastest : ", fastest.Url , " (", fastest.Duration , ")")
echo("Slowest : ", slowest.Url , " (", slowest.Duration , ")")
echo(Str.Set(50, "="))
Comments