You need to creat your own message queue:

in the execute loop of  the tread do something like:

          if PeekMessage(msg,0,WM_USER,cMaxMsg,PM_REMOVE ) then
          begin
              case msg.message of
                  WM_YOUR_MESSAGE_TYPE:
                  begin
                       Proccess you message here
                  end;

                  WM_ANOTER_MESSAGE_TYPE:
                  begin
                      ProcessMessage here
                  end;
                  ........

              end;
          end;
    
and use PostThreadMessage to send the message to the tread.
Look up the exact usage pf the APIs in the help.

Alternativly I have created a TMessageQueue that is Delphi/Kylix cross compatible.
If you are interest I can send it to you.

Mikael


On 10/23/06, Lloyd Thomas <[EMAIL PROTECTED]> wrote:
I have based my app on the echo example, but I have another question. I can send the received starings to the main thread using 'postmessage' using the following, but I have no idea how I would send data back to the client from the main thread. Any Ideas?
 
========================================
procedure TTCPRecvThrd4.Execute;
var
//  s: string;
  LCmd: string;
  MyDataParse4 : pMyDataParse4;
begin
  sock:=TTCPBlockSocket.create;
  try
    Sock.socket:=CSock;
    sock.GetSins;
    with sock do
      begin
        repeat
          if terminated then break;
          LCMD := RecvString(500);
          if lastError<>0 then break;
          SendString(LCmd+#13#10);
          New(MyDataParse4);
          MyDataParse4.IPDataString := LCmd;
          PostMessage(Application.MainForm.Handle, WM_MyDataParse4, 0, integer(MyDataParse4));
          if lastError<>0 then break;
        until false;
      end;
  finally
    Sock.Free;
  end;
end;
==========================================
 
 
 

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

_______________________________________________
synalist-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/synalist-public



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
synalist-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/synalist-public

Reply via email to