Hello, I created a server tcp / ip to receive multiple simultaneous client
connections, so far so good it seems to be working properly, I need to get
more information of these connected clients, list them, do some action etc.
.. I am doing as follows

on ConnectionDataAvailable;
Command: = ReceiveStr;
process information ...

now created a function to list the clients:

   SGCons.RowCount := WSocketServer1.ClientCount + 1;
   for Count := 0 to WSocketServer1.ClientCount - 1 do
      Cliente := TClientConnection(WSocketServer1.Client[Count]);

      SGCons.Cells[0, Count+1] := IntToStr(Count + 1) + 'ยบ';
      SGCons.Cells[1, Count+1] := Cliente.PeerAddr;
      SGCons.Cells[2, Count+1] := DateTimeToStr(Cliente.ConnectTime);
      SGCons.Cells[3, Count+1] := DateTimeToStr(Cliente.LastAction);
      SGCons.Cells[4, Count+1] := IntToStr(Cliente.CliId);


it takes the information normally only if I do the 2x
WSocketServer1.ClientCount property comes zeroed after passing through
Cliente.Free; it seems that closes the connection,'re correct that? need to
receive multiple connections and keep them active and list them ..

  { TClientConnection is used to handle client connections }
  TClientConnection = class(TWSocketClient)
      FRcvdLine : String;         { Buffer for commands              }
      FIndex    : Integer;        { Slot number as known by server   }
      ConnectTime  : TDateTime;
      LastAction  : TDateTime;
      procedure ConnectionDataAvailable(Sender: TObject; Error : Word);
      constructor Create(AOwner : TComponent); override;
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