Re: [twsocket] Connected when not connected
So how should I handle connection errors in a way that makes user aware of error AND not cause any kind of disaster? Catch the error code in OnSessionConnected Yes, indeed. and (using some kind of PostMessage) display actual error message outside OnSessionConnected? If you like it so, no problem. Remember that the statsu won't change automatically if no trafic take place. So you may well display "connected" while the connection is broken (typical example: cabke unplugged). The only way to make sure you have the real status of the connection is to periodically make some traffic. This is the only reliable way doing it. Winsock keepalive packets are not reliable at all as my experience shows. -- francois.pie...@overbyte.be The author of the freeware multi-tier middleware MidWare The author of the freeware Internet Component Suite (ICS) http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] Connected when not connected
Hello! >>> This is how winsock works. OnSessionConnected is fired with an error, >>> after it OnSessionClosed is fired with or without an error. >> So having TWSocket's state different from actual state should be >> considered >> normal? If so, then I understand that checking for component state is NOT >> enough to check whether it is actually connected or not? > Well, you should probably consider you are connected with error. The error > code being available thru the OnSessionConnected event. So how should I handle connection errors in a way that makes user aware of error AND not cause any kind of disaster? Catch the error code in OnSessionConnected and (using some kind of PostMessage) display actual error message outside OnSessionConnected? -- Piotr Dałek enigmati...@interia.pl - Dzwon tanio! Sprawdz >> http://linkint.pl/f29a1 -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] Connected when not connected
This is how winsock works. OnSessionConnected is fired with an error, after it OnSessionClosed is fired with or without an error. So having TWSocket's state different from actual state should be considered normal? If so, then I understand that checking for component state is NOT enough to check whether it is actually connected or not? Well, you should probably consider you are connected with error. The error code being available thru the OnSessionConnected event. -- francois.pie...@overbyte.be The author of the freeware multi-tier middleware MidWare The author of the freeware Internet Component Suite (ICS) http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] Connected when not connected
Hello! > Hi, > This is how winsock works. OnSessionConnected is fired with an error, > after > it OnSessionClosed is fired with or without an error. So having TWSocket's state different from actual state should be considered normal? If so, then I understand that checking for component state is NOT enough to check whether it is actually connected or not? -- Piotr Dałek enigmati...@interia.pl - Zapytaj wrozke! Sprawdz >> http://linkint.pl/f29a2 -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] Connected when not connected
Hi, This is how winsock works. OnSessionConnected is fired with an error, after it OnSessionClosed is fired with or without an error. You should use the events in how to access the component. -- mvg, Wilfried http://www.mestdagh.biz http://www.comfortsoftware.be http://www.expertsoftware.be > -Oorspronkelijk bericht- > Van: twsocket-boun...@elists.org [mailto:twsocket-boun...@elists.org] > Namens Piotr Dalek > Verzonden: dinsdag 3 mei 2011 11:22 > Aan: TWSocket > Onderwerp: [twsocket] Connected when not connected > > Hello. > > In WSocket's DO_FD_CONNECT procedure, the socket state is set to > wsConnected > even if the socket has failed to connect (for example, on 10061 error), > then > the SessionConnected handler is called and after that, check for actual > error is performed, where socket is closed when error is not zero (like > 10061). Im not sure if this is correct - shouldn't be the error > checking > performed first? > > I'm asking because I have some code that checks for TWSocket's state to > access some of the properties. In some cases it's possible that when > socket's State is wsConnect, my code accesses, among other things, > GetPeerPort and GetXPort which results in exceptions because socket is > not > actually connected. > > -- > Piotr Dałek > enigmati...@interia.pl > > - > Dzwon tanio! > Sprawdz >> http://linkint.pl/f29a1 > > -- > To unsubscribe or change your settings for TWSocket mailing list > please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket > Visit our website at http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
[twsocket] Connected when not connected
Hello. In WSocket's DO_FD_CONNECT procedure, the socket state is set to wsConnected even if the socket has failed to connect (for example, on 10061 error), then the SessionConnected handler is called and after that, check for actual error is performed, where socket is closed when error is not zero (like 10061). Im not sure if this is correct - shouldn't be the error checking performed first? I'm asking because I have some code that checks for TWSocket's state to access some of the properties. In some cases it's possible that when socket's State is wsConnect, my code accesses, among other things, GetPeerPort and GetXPort which results in exceptions because socket is not actually connected. -- Piotr Dałek enigmati...@interia.pl - Dzwon tanio! Sprawdz >> http://linkint.pl/f29a1 -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be