Sign in to follow this  
Followers 0
Arclite86

limit time for a function

6 posts in this topic

somethime a function takes to much time it may get stuck or just fail, is there a way to limit the time for a function so it can continue running the next functions?

 

 

Share this post


Link to post
Share on other sites



Can you post a recreation of this? Because I've never experienced this problem.


MCR.jpg?t=1286371579

Most recent sig. I made

Quick Launcher W/ Profiles Topic Movie Database Topic & Website | LiveStreamer Pro Website | YouTube Stand-Alone Playlist Manager: Topic | Weather Desktop Widget: Topic | Flash Memory Game: Topic | Volume Control With Mouse / iTunes Hotkeys: Topic | Weather program: Topic | Paws & Tales radio drama podcast mini-player: Topic | Quick Math Calculations: Topic

Share this post


Link to post
Share on other sites

You can add "error checking" to exit the function.

 

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

no its not an error i have an function that i got from a previous post, but because this is a new subject/question i started this one 

this is the script:  

Global $websiteread, $PingTimeout = 2000

Func _UrlExists($websiteread)
    If (StringLen(InetRead($websiteread, 1)) > 0) Then Return 1
    If Ping($websiteread, $PingTimeout) Then Return 2
    Return 0
EndFunc   ;==>__checkConn

    If _UrlExists($websiteread) Then
        ConsoleWrite("Exists" & @LF)
          
        ContinueLoop
    EndIf
    ConsoleWrite("Not Exists Or No Response in " & @LF)
  
    ConsoleWrite("not Exists" & @LF)

 

 

 

when this happens it works fine in less then a second (bellow)

 

If _UrlExists($websiteread) Then
        ConsoleWrite("Exists" & @LF)

 

but when this happens it can take up to 5 second, so i want it to skip after because it wil take to much time if you run this in a full script (bellow) 

EndIf
    ConsoleWrite("Not Exists Or No Response in " & @LF)
  
    ConsoleWrite("not Exists" & @LF)

 

Share this post


Link to post
Share on other sites

You can't set a timeout for InetRead

Share this post


Link to post
Share on other sites

Go look at my response in your original thread...


Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
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
Sign in to follow this  
Followers 0