>>> Does anyone have ideas why TIcsWndControl.ProcessMessages could >>> hang sometimes when socket is used in separate thread? > >>Have you followed the rules: create TWSocket within the thread's execute >>method OR call ThreadAttach ? > > Yes socket is created within threads execute method, and it works most of > the time. > I call it after calling shutdown like this, could it be related? > > FSocket.Shutdown(SD_BOTH);
>What do you mean by "I call it after..." ? >Actually ProcessMessages probably doesn't hang. ProcessMessages it the place >from where all events are called. It is likely an event handler which is >blocking. You should try to find out where. I call it like this, the only event that is called is SslShutDownComplete which sets FSSLShutdownComplete property, I don't have any other event processing here FSocket.Shutdown(SD_BOTH); EndTime := GetTickCount + FTimeout; while {$IFDEF USE_SSL} not FSSLShutdownComplete {$ELSE} False {$ENDIF} do begin if GetTickCount > EndTime then break; Sleep(10); FSocket.ProcessMessages; end; I am now trying to use only main thread with socket, but there is another problem when I use it directly from main thread it works fine, but when I call it using Synchronize from another thread after first portion of data is sent socket closes with 10053 error. Any ideas what could be the problem? It is an SSL connection. And how to recover from 10053 error? When I call Socket.Connect again it still remains closed. -- 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