Prev: The NNTP exodus continues.
Next: VB6 to Web
From: David on 10 May 2010 18:17 I have a program (I'm the client) that connects to a server. The server reboots everyday (out of my control) at 4:45:00 for three seconds. At this time my program hangs (stops receiving data) and does Not continue after the three second interruption. Is there a solution to reestablish or maintain this connection other than: 1) manually reconnecting, or 2) setting up a time tracking program to have XP close and then re-start my program -- (can see problems with this if the server changes reboot time) Thanks David
From: ralph on 10 May 2010 20:42 On Mon, 10 May 2010 18:17:16 -0400, "David" <NoWhere(a)earthlink.net> wrote: >I have a program (I'm the client) that connects to a server. >The server reboots everyday (out of my control) at 4:45:00 for three >seconds. > >At this time my program hangs (stops receiving data) and does Not >continue after the three second interruption. > >Is there a solution to reestablish or maintain this connection other than: > >1) manually reconnecting, or >2) setting up a time tracking program to have XP close and then > re-start my program -- (can see problems with this if the > server changes reboot time) > >Thanks >David > > Difficult to answer without more information, but generally there is a solution. Stepping back a bit, it is a poor design that allows a program to "hang" just because it has lost connection with some resource. At the very least you should have simple error handling in place to detect this and allow the program to close gracefully. From this point it should be an easy step to design a recovery mechanism. -ralph
From: David on 10 May 2010 22:16 Ralph: Thanks for response. "Hang" was a poor choice of wording on my part. App still functions just isn't receiving data. Better choice wording should of been "have auto reconnect back to server" From this point it > should be an easy step to design a recovery mechanism. Above statement doesn't help a lot. For example: how do I detect that connection was lost so I can begin recovery? Any ideas? "ralph" <nt_consulting64(a)yahoo.net> wrote in message news:li9hu590v6ihfg9mmrmgflhqjio6rilh4a(a)4ax.com... > On Mon, 10 May 2010 18:17:16 -0400, "David" <NoWhere(a)earthlink.net> > wrote: > >>I have a program (I'm the client) that connects to a server. >>The server reboots everyday (out of my control) at 4:45:00 for three >>seconds. >> >>At this time my program hangs (stops receiving data) and does Not >>continue after the three second interruption. >> >>Is there a solution to reestablish or maintain this connection other than: >> >>1) manually reconnecting, or >>2) setting up a time tracking program to have XP close and then >> re-start my program -- (can see problems with this if the >> server changes reboot time) >> >>Thanks >>David >> >> > > Difficult to answer without more information, but generally there is a > solution. > > Stepping back a bit, it is a poor design that allows a program to > "hang" just because it has lost connection with some resource. At the > very least you should have simple error handling in place to detect > this and allow the program to close gracefully. From this point it > should be an easy step to design a recovery mechanism. > > -ralph > >
From: Nobody on 10 May 2010 22:45 "David" <NoWhere(a)earthlink.net> wrote in message news:uvS9EAL8KHA.5412(a)TK2MSFTNGP06.phx.gbl... > Ralph: > Thanks for response. > > "Hang" was a poor choice of wording on my part. App still functions > just isn't receiving data. Better choice wording should of been > "have auto reconnect back to server" > > From this point it >> should be an easy step to design a recovery mechanism. > > Above statement doesn't help a lot. For example: how do I detect that > connection was lost so I can begin recovery? You need to check both "Error" and "Close" events, check State property, and then close/reconnect. If you are using a random port, make sure that you reset LocalPort back to 0 just before calling Connect. Close event doesn't fire when you call Close method, it happens when the other side close the connection normally.
From: David on 10 May 2010 23:00
As always, thanks for input Nobody. > You need to check both "Error" and "Close" events, check State property, > and then close/reconnect. If you are using a random port, make sure that > you reset LocalPort back to 0 just before calling Connect. Close event > doesn't fire when you call Close method, it happens when the other side > close the connection normally. Not sure what you're referring to here -- Winsock?? In my case I'm using a dll supplied by the server vendor. Dll does have an error event (which I trap), but doesn't appear to fire when they reboot. They do send a timestamp about every second (that's how I know when I'm dropping). One thought is I could maybe poll their timestamp on my end, and if stops updating for 3 seconds, attempt a reconnect. Got a better idea? "Nobody" <nobody(a)nobody.com> wrote in message news:%23Xwh9PL8KHA.3880(a)TK2MSFTNGP04.phx.gbl... > "David" <NoWhere(a)earthlink.net> wrote in message > news:uvS9EAL8KHA.5412(a)TK2MSFTNGP06.phx.gbl... >> Ralph: >> Thanks for response. >> >> "Hang" was a poor choice of wording on my part. App still functions >> just isn't receiving data. Better choice wording should of been >> "have auto reconnect back to server" >> >> From this point it >>> should be an easy step to design a recovery mechanism. >> >> Above statement doesn't help a lot. For example: how do I detect that >> connection was lost so I can begin recovery? > > You need to check both "Error" and "Close" events, check State property, > and then close/reconnect. If you are using a random port, make sure that > you reset LocalPort back to 0 just before calling Connect. Close event > doesn't fire when you call Close method, it happens when the other side > close the connection normally. > > > |