Newsgroups : Borland : borland.public.delphi.internet.winsock : 2007 Apr : Re: Delphi 7 & Indy 10 TidCmdTCPServer OnCommand Event
| Subject: | Re: Delphi 7 & Indy 10 TidCmdTCPServer OnCommand Event |
| Posted by: | "Codeman II" (thegentlem..@webmail.co.za) |
| Date: | Thu, 12 Apr 2007 20:42:37 |
> LList := LServer.Contexts.LockList;
> try
> for I := 0 to List.Count - 1 do
> begin
> try
> LContext := TIdContext(List[I]);
> if LContext <> ASender.Context then
> begin
> // send ACommand to LContext as >
needed...
>
LContext.Connection.IOHandler.WriteLn(ASender.RawLine);
> Log.Write(dirOUT, 'Broadcasting to: ' > +
LContext.Connection.Socket.Binding.PeerIP, LLocalIP);
> end;
> except
> end;
> end;
> Log.Write(dirNone, '', '');
> finally
> LServer.Contexts.UnlockList;
> end;
Hi Remy,
Can you please explain the code snippet above.
I took it from your example.
What I actually was trying to do is to keep a list of all client computers.
When a client starts up it sends a "ConnectDB" command to the server and
then a "Quit".
The server in return must then add that client (if it does not already
exists) into a stringlist or so in
order to broadcast new changes to all clients.
Is my logic fine?
How would you suggest I must do this?
Thanks a lot!