No. That is a completely separate connection, subject to the same networking rules, restrictions, and limitations as the previous connection. There is no guarantee that just because one connection succeeded then another connection will also succeed. They are treated independently.mark_c wrote:If I start with socket ctNonBlocking and make the connection and once the connection is established I use the OnConnect event to close the socket ctNonBlocking and reopen a new one with ctBlocking could it work?
Also, the code you presented will not work anyway, because you are exiting from the thread as soon as TClientSocket::Open() begins the connection process, before the OnConnect event can be fired. Remember, TClientSocket in non-blocking mode REQUIRES a message loop.
Also, your OnConnect code is leaking the original TClientSocket object when it creates a new object.
Yes.mark_c wrote:when the OnConnect event is generated it means that the Three-Way Hand Shake was successful and the connection was made correctly right?
It is possible that the connection was closed on the server itself, or maybe by a proxy/router sitting in between the client and server, after the handshake was complete.mark_c wrote:Sometimes it seems to me that even after the OnConnect event the connection does not actually work, as if there was no connection