socketTimeoutInterval is NOT for connecting
Dar Scott
dsc at swcp.com
Mon Oct 28 21:45:01 EST 2002
On Monday, October 28, 2002, at 06:19 PM, 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...
If the target computer refuses the tcp connection attempt some Windows
systems will force a delay of 9 seconds. If the target computer does
not respond some Windows systems will wait for 21 seconds. On OS X, I
have seen delays around 75 seconds if there is no target computer. I'm
not sure, but I think if the connection is rejected it responds
immediately.
(I have seen some problems in the callback never showing up in
connections to the same computer or in connections by a very slow
computer with Windows 2000 or XP. This has been fixed in MC 2.5A7.)
On Windows, you will (now) get either the callback or a socketError().
On OS X you will get either a callback or something else. The something
else has been socketClosed(), but that may have changed to socketError().
The solution I would try (actually, I will try, so I'm interested in
what others make work) would be to use a send in time at the same time
as the open. If any of the callbacks come in first, they cancel it. If
it comes in first, it cleans things up. I assume a close socket will
clean things up.
An alternate strategy is to make very little dependent on the wait. In
addition, perhaps a cancel button (if appropriate) can do the work of
the send-in-time instead of the send-in-time.
Dar Scott
(A Rev user sneaking in and sitting in on the back row and speaking up
more than he should)
More information about the metacard
mailing list