Thanks to Glenn and Fargo for their suggestions. In this particular case, I'm not directly opening the socket to the server. I'm using the Windows TAPI service. So I can't check for a socket error directly. But your suggestions gave me an idea, and I started looking for any error codes from TAPI that might indicate a network error, and I found 2. So I'm using them to reopen the connection after a failure. These error codes are undocumented, but they seem pretty consistent.
On 4/18/07, Glenn L. Austin <[EMAIL PROTECTED]> wrote: > > An even better solution, since it would work for cases of network > connection loss. > > Even better than check the delta time between the current time and > last time checked. > > On Apr 17, 2007, at 10:17 PM, Fargo Holiday wrote: > > > Well, there may be some way to check the state with the Win32 API or > > WMI, but the timing would probably be tricky. Checking the time, as > > suggested by Glenn, might work, but strikes me as possibly unreliable, > > since hibernation can be triggered by a variable timer and user > > commands. Unless I totally missed his thought process there. > > > > Why not just provide an automated re-connect for the app? If the > > socket > > connection fails have it attempt to re-connect, up to x number of > > times, > > then maybe give a warning with a manual re-connect button. Or > > something > > to that effect. I don't think it's realistic to assume an application > > will have a perfect network experience, and a re-connect save you > > headaches from unforeseen outages. > > > > Good luck, > > Fargo > > > > Jim Dossey wrote: > >> I have an app for Windows that opens a socket to a server and > >> receives > >> various updates from the server. To run it, I simply put a > >> shortcut to the > >> app in the Startup folder in the Start menu. But I found out that > >> some > >> users don't shutdown their PC's. Instead they use Hibernate. The > >> problem > >> is that the socket gets closed on the server end, so that when the > >> machine > >> is started up again, the app is still running, but the socket is > >> no longer > >> working. Is there some way to tell either when a machine is going > >> into or > >> out of hibernate mode? > >> > >> Thanks, > >> Jim > >> Win XP, RB 2007R2 > >> _______________________________________________ > >> > >> > -- > Glenn L. Austin <>< > Computer Wizard and Race Car Driver > <[EMAIL PROTECTED]> > <http://www.austin-home.com/glenn/> > _______________________________________________ Unsubscribe or switch delivery mode: <http://www.realsoftware.com/support/listmanager/> Search the archives: <http://support.realsoftware.com/listarchives/lists.html>
