I'm working with some web stuff and my script is downloading files from the internet. but if a file is not available or very slow i want my script to continue with next file. how do I do that?

In my opinion, the problem when "it takes too long" in this context, is that a certain function call blocks. The first question is to find the innermost function which blocks. Often, low level functions which attempt to obtain data through a connection have a time delay argument, or a non blocking mode can be set. For example on a socket object, you can use the method Socket.settimeout to prevent the socket from blocking if it takes too long to receive or send data. Then you can break the loop.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.