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