Why we are jumping to the another planet now?
We are soo close!!

Can you please see the code!
This is just getting complicated all the time.

Isn't this component having anything such as: CLIENTID?, CLIENTNO?, ID? which could be posted here in the same way as the IP address and the Port?

Come on guys,
This can't be this complicated!
too many opinions but none simple??

Here is what I have,
procedure TSimpleSslServerForm.SslWSocketServer1ClientConnect(
  Sender : TObject;
  Client : TWSocketClient;
  Error  : Word);
  with Client as TTcpSrvClient do begin
      Display('Client connected.' +
'[' + THEID or the CLIENTNUMBER or ANYTHING which helps to identify + ']' + ///Here I need to get this info into the
              ' Remote: ' + PeerAddr + '/' + PeerPort +
              ' Local: '  + GetXAddr + '/' + GetXPort);
      Display('There is now ' +
              IntToStr(TWSocketServer(Sender).ClientCount) +
              ' clients connected.');
      LineMode            := True;
      LineEdit            := True;
      LineLimit           := 80; { Do not accept long lines }
      OnDataAvailable     := ClientDataAvailable;
      OnLineLimitExceeded := ClientLineLimitExceeded;
      OnBgException       := ClientBgException;
      OnSslVerifyPeer     := ClientVerifyPeer;
      ConnectTime         := Now;

Actually, TWSocketServer(Sender).ClientCount-1 will be your client
number, until one of the client disconnect.

Since it's a dynamic array, when a client disconnect, the client
number will change.

That`s why you need another way to identify your clients.

From memory, when my client connected, they would send the server
their unique ID and I would store that into a property of the client
socket. You have to derive your client socket and add properties to

Something like :

 TTcpSrvClient = class(TWSocketClient)
   ConnectTime : TDateTime;
   UniqueID : string;

then you assign that client socket in the server initialization (in
the TcpSrv demo,in WMAppStartup) :

   WSocketServer1.ClientClass := TTcpSrvClient; { Use our component }

Then when I wanted to send a command to a particular client, I would
just iterate all connected client searching for the right ID.

To unsubscribe or change your settings for TWSocket mailing list
please goto
Visit our website at
To unsubscribe or change your settings for TWSocket mailing list
please goto
Visit our website at

Reply via email to