Is it possible to set a timeout value when calling a function in .NET? I am using a third party component called SharpBox that loops a set of Dropbox accounts and pulls in the contents to a given folder on my server.
Dim itemsDownload as integer = pollSingleDropboxAccount(accountID)
function pollSingleDropboxAccount(accountID as integer) as integer
//Utilises Sharpbox to download the files and return the count
//In here a connection is established using the SharpBox.dll
//but never gets closed or throws an exception leaving the
//function to hang indefinitely
end function
Sharpbox uses a HTTPWebRequest behind the scenes to contact the Dropbox API but seems to default the timeout to infinite and this value cannot be overridden. I've lodged a feature request with SharpBox but I'm looking for something we can use in the mean time as a workaround.
To circumvent this I'm wondering if we can wrap something around the call to the 'pollSingleDropboxAccount' function to give up after say 5 minutes?