So, if I want to implement several sockets in a single threads, how do I 
perform a message loops on each of them?

This

procedure TMyThread.Execute;
begin
        WSocket1  := TWSocket.Create(nil);
        try
             Assign event handlers and properties..
              WSocket1.Connect;
             // Start the message loop, post WM_QUIT message latert to break 
the loop.
              WSocket1.MessageLoop;
       finally
              WSocket1.Free;
      end;
end;

works only if we create one thread for each socket. I tried this:

procedure TSocketThread.Execute;
var i: integer;
begin
  ..create and run .Connect...

   while not Terminated do
     for I := 0 to length(clients) - 1 do
     begin
       if clients[i]<>nil then clients[i].MessagePump;
     end;

end;

is it right?

--
Regards, Anton
-- 
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