On Sep 30, 2006, at 9:02 PM, Dennis Birch wrote:
I just ran into a situation I thought I was covering. Some of my
applications have version check code that uses a HTTPSocket to
fetch a small file from the Web that contains the latest version
number. Before using the Get method on the HTTPSocket, I check its
localAddress property to see if it has an IP address. I thought
this was protecting against downed connections. But tonight my DSL
modem crapped out temporarily, and my application locked up because
the socket was still reporting a valid IP address and the code
proceded to calling the HTTPSocket.Get method.
Is that expected behavior? If so, is there any other way to work
around it? Can I set a timeout on the socket so that such a lockup
would be reasonably brief?
I discovered this in RB 2006r3 under Mac OS X 10.4.7.
Local address is valid any time you are connected to a network. This
network does not have to be connected to the internet. If you want
to check and see if you are connected to a Network, then you can use
the System.Network.IsConnected( ) method.
But like I said, it does not guarantee that the computer is connected
to the Internet.
Depending on how you use the HTTPSocket, you should have a Timeout
period or you should be using Events. If you have the Timeout period
set to zero and the server cannot be found, then your program would
lockup indefinitely. While not as convenient, it is better to
Subclass the HTTPSocket and use the Events... you will then receive
an Error event almost immediately if the computer is not connected to
the internet or if your hosting account is unavailable.
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>