Socket: how execute two threads simultaneously without stop?
<p>in a socket connection between client-server, i'm receiving informations about remote pc in a thread (in a loop) and a other specific info in another thread.</p>

<p>My problem is because when second thread is created the first is stopped immediately, but info that i want receive using second thread is necessary a loop as show below on code.</p>

<p>So, how can execute two thread simultaneously without stop some thread?</p>

<pre><code>    // Entry point of first thread

    procedure TSock_Thread2.Execute;
     var
     s: String;

    begin
      inherited;

      while not Terminated and Socket.Connected do
      begin
        if Socket.ReceiveLength &gt; 0 then
        begin
          s := Socket.ReceiveText;

          if Pos('&lt;|CUR|&gt;', s)&gt;0 then begin

          TSTMouse := TSock_Thread5.Create(Socket);
          TSTMouse.Resume;

          Socket.SendText('&lt;|GETCURSORICON|&gt;'); // after this line, TSock_Thread2 stop your execution 

          end;

       end;
    end;



// Entry point of second Thread

    procedure TSock_Thread5.Execute;
    var
    s, Ponteiro: string;

    begin
      inherited;

        while not Terminated and Socket.Connected do
          begin

            if Socket.ReceiveLength &gt; 0 then
            begin
              s := Socket.ReceiveText;

              if Pos('&lt;|MOUSEICON|&gt;', s) &gt; 0 then // receiving mouse icon here
              begin

                Delete(s, 1, Pos('&lt;|MOUSEICON|&gt;', s) + 12);
                Ponteiro := Copy(s, 1, Pos('&lt;|&gt;', s) - 1);

                if Ponteiro &lt;&gt; '' then

                (Form1.LV1.Selected.SubItems.Objects[2] as TForm2).lblPoint.Caption := Ponteiro;

                Sleep(100);
                Socket.SendText('&lt;|GETCURSORICON|&gt;'); // request cursor icon again

              end;

            end;
          end;

        end;
</code></pre>