daniel cc wrote:
>> -------------------------------------------------------------------------------------------------------------------------------------------------------------
> SslWSocketServer1.Client is an array of your clients.
> So if you have 2 clients, the first one is Client[0] and the second
> one is Client[1].
> If you have a third client then he's at Client[2].
>
> I think you get the picture
>>>
> Yes,
> I get the picture.
>
> so change your procedure to something like this :
> procedure TSimpleSslServerForm.SendCommand(ClientNo: integer);
> begin
> SslWSocketServer1.Client[ClientNo].SendStr(ledSendCommand.Text);
> Display('Command sent: ' + ledSendCommand.Text);
> end;
>>>
> How do you set this --> (ClientNo)?
> How do you get the number in here?
>
> Can you please explain a bit?
What is so difficult? Property Client is an array of currently
connected client objects, property ClientCount returns the number
of objects in that array. You work with it like with a standard
Delphi TList as well. For example, in order to iterate over all
client objects:
var
Cli: TWSocketClient;
begin
for i := 0 to WSocketServer1.ClientCount -1 do
begin
Cli := WSocketServer1.Client[i];
if Cli meets some condition here then
Call some Cli.method;
end;
end;
However usually a protocol follows the request/response pattern.
That is client requests something and server responds to that
client request, usually there's no need to iterate over the client
list or to search for a particular client object.
--
Arno Garrels
--
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