Jump to content

_INetGetSource Timeout?


Recommended Posts

Hi All

sifted through 5 pages of search with no results.

is there a timeout on _INetGetSource?

currently i am opening a new IE window, reading the source, and closing it again (or recycling it for the next function that needs to read a page source)

i know _INetGetSource will be a better option, but i have not found any info on a timeout. Currently set the timeout in ie.au3 to just 10 seconds as i dont want it to stall my script (all web pages are on internal network so load fast)

anyway..

a) is there a timeout?

:P if so, how long is it?

c) if so, can it be changed?

Thanks for all help

Craig

Link to comment
Share on other sites

a) No _INetGetSource doesn't have a timeout by looking in the actual source INet.au3 and that also answers :P and c)

However I believe you are trying to just get the source, so without getting anything that loads pictures/sound/animation (can be found in Internet Explorer's perference bar) you could accomplish this task and have it just dump the text right there.

Contact via MSN: [email=terarink_msn@hotmail.com]terarink_msn@hotmail.com[/email], yahoo: terarink_yah

Link to comment
Share on other sites

You could setup another script working with this one but your checking it every 1/4 second or whatever you decide so anything can be added with the timeout function inside those DLLCalls

Contact via MSN: [email=terarink_msn@hotmail.com]terarink_msn@hotmail.com[/email], yahoo: terarink_yah

Link to comment
Share on other sites

  • 11 months later...

Sorry to bring up an old topic, but does anyone have a good way to add a timeout to this function(_INetGetSource).

I am working on something for my vistumbler program that may be used over a flakey internet connection. I was testing today and it took 12 seconds before timing out, which is way to long. I would like to set the timeout to something like 800ms. anybody have any suggestions?

This is what I am working on --> http://forum.techidiots.net/forum/viewtopic.php?f=33&t=352

Edited by ACalcutt

Andrew Calcutt

Http://www.Vistumbler.net

Http://www.TechIdiots.net

Its not an error, its a undocumented feature

Link to comment
Share on other sites

There's a problem with _INetGetSource is that it doesn't verify if the file exist or not, but it acts like IE. Like when i try to open a webpage using a browser, if the web page doesn't exist, the browser redirect me to the home page of the webhost, and _INetGetSource get the source of the redirection page -.-

Link to comment
Share on other sites

So just check the return, you should read text in <title>...</title> tab to trap your own errors.

Yes, but it shouldn't be like that. It should return error if the page doesn't exist.

Now, here is a question for you. If I use a direct link of rapidshare, would INetGet return: the file to download, the page redirection to premium page or an error?

Link to comment
Share on other sites

  • 6 months later...

I have mixed feelings with the Opt("TCPTimeout") usefulness. Also Trancexx recently answered she thought the option abandonned long ago.

Here's why I have problem with the Inet functions. I use them routinely (several times a day) to update my local database with new tracking events for the parcels we ship worldwide. One of the tracking site I use can be _very_ slow to produce an answer: I'seen response time > 60s. I guess the transaction I'm using is buried deep in their server forest and given lowest priority. I'm anyway extremelly happy it answers at all.

I have tried InetGetSource, InetGet and InetRead with about the same results for this particular site. The issue is that sometimes the site simply won't answer nor reset the connection. In this case, all three functions just hang, hanging the entire script as well.

I tried AutoItSetOption('TCPTimeout', $value) with various values to absolutely no avail. Therefore I suspect Trancexx is right: this "option" seems to be no-op.

Another point closely related to the topic: the only way to get back from the hung condition exposed above is to use a background InetGet() followed by a timing loop.

Of course you never know when a site may cause a hung Inet connection. You have to protect against such and adopt the "monitored backgroud" version.

But then since this is the only way to invoke Inet* without risk, why isn't such code included in the native functions?

How do _you_ protect against hung condition and do you think an integrated timeout with optional value would be useful?

Edited by jchd

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

  • 3 years later...

func inetread_timeout()
    dim $Timer,$PID,$initread_server,$chars,$timer_result,$timeout_server=10 ;second
    filedelete(@tempdir&"\initread.txt")
    $Timer = TimerInit()
    $PID = Run(@AutoItexe & ' /AutoIt3ExecuteLine "filewrite(@tempdir&''\initread.txt'',inetread( ''http://www.google.com'',1))"',"",@SW_HIDE)  
    While 1
        If $pid=0 or TimerDiff($Timer)/1000 >= $timeout_server Then
            $timer_result=TimerDiff($Timer)
            ProcessClose($PID)
            msgbox(48,"Error","timeout = "&$timer_result)
        ElseIf FileExists(@tempdir&"\initread.txt") and not ProcessExists($PID) then
            $timer_result=TimerDiff($Timer)
            $chars=fileread(@tempdir&"\initread.txt")
            filedelete(@tempdir&"\initread.txt")
            msgbox(64,"timeout = "&$timer_result,$chars)
        Else
            continueloop
        EndIf
        exitloop
    WEnd
endfunc

To community goes all my regards and thanks

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...