sl.text will send last inserted record to tstringlist it will not send each
client connected

On 19 March 2016 at 00:12, matrin loanel <maretinloa...@gmail.com> wrote:

> i give up i searched a lot on how to send memory stream with Command to
> client i just wanted to send client list from server to client here is the
> code that i working on i dont really know what to do to send that
> clientcount that i collected from server and how to handle it to the client
> .
>
> //////////code//////////////
>
> procedure TMyClient.SendClientsList;
> var
> I, J: Integer;
> SL: TStringList;
> MS: TMemoryStream;
> Client : TMyclient;
> Server : TWSocketServer;
> begin
> Server := mainserver.server;
>  try
>   SL := TStringList.Create;
>     // Collect List
>     for J := 0 to Server.ClientCount - 1 do
>     begin
>       Client := TMyclient(Server.Client[J]);
>       SL.Add(Client.Name + Sep + IntToStr(Client.UniqueID) + Sep +
> Client.CURROOM + Sep + Client.icon);
>     end;
>
>     // Send List
>     for I := 0 to Server.ClientCount- 1 do
>     begin
>       Client := TMyclient(Server.Client[J]);
>       if (SL.Count > 0) then
>       begin
>         MS := TMemoryStream.Create;
>         try
>           SL.SaveToStream(MS);
>           MS.Position := 0;
>           //what to do to send ?
>         finally
>           MS.Free;
>         end;
>       end;
>     end;
>   finally
>   SL.Free;
>   end;
>
> //////////end//////////
>
>
-- 
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