How to timeout in a function call

I am currently downloading some data from a remote server, however the connection may not always be stable and therefore the data loading might hang. Therefore, I would like break the connection and restart it after a certain period of time. How do I do this?

Say, I want to do:

NCDatasets.load!(OPeNDAP URL HERE,tmparray,:,:,1)

How do I set a condition outside such that if this function doesn’t finish executing in 10 seconds, I break the loop and try it again?

Potentially useful:

Unless you can use download for this task.

1 Like