Eugene Kotlyarov wrote:
>>>> 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;

Looks like you try to workaround the asynchronous nature of TWSocket
which were a bad idea. Where do you call this and what do you want
to achieve? 

> 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. 

TWSocket works well in a worker thread if you do it all right.
What do you call in Synchronize? Show us the code of the synchronized
method. My impression is that you do not use the component correctly.

Arno Garrels      
To unsubscribe or change your settings for TWSocket mailing list
please goto
Visit our website at

Reply via email to