[b][red]This message was edited by VampireFE at 2007-1-9 6:19:41[/red][/b][hr]
I am making a program using TClientSocket. I connect to the server with it and when i am connected, i start sending data. The code simplified looks like this:
Application->ProcessMessages(); // Application->HandleMessage();
TermConnected is changed to true when OnConnect occurs. (TClientSocket event) After that i start sending data to server. Normally it works ok, but sometimes ProcessMessages or HandleMessage functions break out from this function and never come back to it which screws everything up. Connection to the server is open but is never closed, because function doesn't end. And so, when i call this same function again, i cannot connect again, because only one session is allowed at the same time.
Anyone can help me understand this or have any solutions?
Edit: Ok, i figured out what happens.. these functions happen to launch one event, that is quite long and in there i call this function again. That is before processmessages/handlemessage is over.
So is there a way to work around this?