A Drent wrote:

> AFAIK you should never use your own messagepump which could come in
> conflict with the components. But I can be mistaken though.

Method MessagePump is fine since it works when Forms.pas is not used
or IsMultithreaded is set to TRUE and it triggers event OnMessagePump if 
assigned. However you should not call sleep but MsgWaitForMultipleObjects()
instead, somethink like this:

var
    StartTicks : LongWord;
    WRes       : LongWord;
    Dummy      : Byte;
    LTimeOut   : Integer;
begin
    bMsgOk := false;

    StartTicks := GetTickCount;
    LTimeOut := 30000;
    repeat
        WRes := MsgWaitForMultipleObjects(0, Dummy, False, LTimeOut, 
QS_ALLINPUT);
        CliSocket.MessagePump;
        LTimeOut := 30000 - IcsCalcTickDiff(StartTicks, GetTickCount);
    until bMsgOk or (WRes = WAIT_FAILED) or
        {$IFNDEF NOFORMS} Application.Terminated or {$ENDIF} (LTimeOut <= 0);

    result := Buffer;

--
Arno Garrels
--
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

Reply via email to