socketTimeoutInterval is NOT for connecting

Dave Cragg dcragg at lacscentre.co.uk
Tue Oct 29 03:28:01 EST 2002


At 5:19 pm -0800 28/10/02, RCS wrote:
>   I use 'socketTimeoutInterval' quite often...but that is for reading and
>writing to a socket that is already open. I am looking for a timeout setting
>for 'connecting' to a socket. If I use 'open socket' to connect to a device
>that is either offline (or invalid), I would like to set a time out of 5 or
>10 seconds (the device usually responds in 1) instead of the default 1
>minute. I can only get so many cups of coffee in a day you know...

Dar suggested a way to handle this. The latest version of libUrl 
(1.0.8b1) has an internal routine similar to Dar's idea. If you look 
towards the bottom, you will see a function handler named 
ulOpenSocket. Used in combination with the two handlers following, it 
uses the current socketTimeoutInterval to determine a timeout when 
opening a socket.

You could copy these handlers to your own script, and modify as 
necessary. (I'd suggest changing the names at least to avoid any 
potential name conflicts down the line.) Be sure to add the script 
locals that are used in these handlers at the top of your script. And 
you'll also need the usual socketError handler to catch errors.

If you don't have it already, you can get the latest liburl version here:
<http://www.runrev.com/revolution/developers/interimreleases/liburl/releases.shtml>

Cheers
Dave



More information about the metacard mailing list