Checking online for current version

BlitzMax Forums/BlitzMax Programming/Checking online for current version

siread(Posted 2008) [#1]
I want my game to check an online file to see if it is the current version. I was intending to do this with a simple ReadFile(http::) but noticed that if the site is down the game hangs waiting for the file. Is there any way to timeout if the file cannot be found? Or is there perhaps a more efficient way of doing this?


jkrankie(Posted 2008) [#2]
local success=readfile(blahblahblah)
if success then do something
else don't do something
end if

or you might look at try..catch blocks

Cheers
Charlie


DavidDC(Posted 2008) [#3]
Check Brucey's libcurl module. I think the setting you are looking for is CURLOPT_TIMEOUT but I'm not sure since it's a while since I've been there.


Brucey(Posted 2008) [#4]
the setting you are looking for is CURLOPT_TIMEOUT

Or you can do an asynchronous call, which won't block - instead you "poll" the connection for data. You can also apply the timeout setting to it.