Éric Fleming Bonilha wrote: >> Éric, > >> Since ICS works asynchronous a reconnect-timer should be started from >> event handler OnSessionClosed, is that the case? >> Also the best place to destroy the object is from OnSessionClosed as >> well. > > But the OnSessionClosed event will be triggered if I try to connect > to an > inacessible host?
Yes, after Connect executed without an exception (better wrap Connect in a try except block) OnSessionConnected as well as OnSessionClosed will fire, the error passed to OnSessionConnected may be helpfull. > > I think that my actual reconnect-timer is bugged, because lets > imagine that > I call the connect routine to make a connection, if the host is > unavailable > it will take some time to return me a connection error event right? > And this > time is more than 4 seconds.. but on my actual implementation I wait > just 4 > seconds before trying to open the connection again, and I don´t know > if this > can mess with windows TCP implementation You have to call Abort once Connect has been called and OnSessionClosed has not been triggered yet to abort the session. Then in OnSessionClosed start the timer or post a custom message if you want to reconnect at once. > > Éric -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be