title: How do I distinguish connections from multiple clients with the same IP address?
body: <p>What is the proper way to identify clients if they have the same IP and ports? If they are only connected via LAN, e.g. ip: 198.162.1.1 port: 2015. How do I detect which client has disconnected using its unique ID if they have the same IP?</p>
  
  <pre><code>TClient = class(TIdServerContext)
    private
    public
      PeerIP      : String;     
      procedure SendMessage(cIP, mStr : String);
    end;
  
  procedure TClient.SendMessage(cIP, mStr : String);
  var
    Context: TClient;
    List: TList;
    I: Integer;
  begin
    List := Form1.IdTCPServer1.Contexts.LockList;
    try
      for I := 0 to List.Count-1 do
      begin
        Context := TClient(List[I]);
        if (Context.PeerIP = cIP) then
        begin
          Connection.IOHandler.WriteLn(mStr);
          Break;
        end
      end;
    finally
      Form1.IdTCPServer1.Contexts.UnlockList;
    end;
  end;
  </code></pre>
  
  <p>I'm only storing the client IP and using it as an ID.</p>
  
  <pre><code>procedure TForm1.IdTCPServer1Execute(AContext: TIdContext);
  begin
    with TClient(AContext) do
    begin
      if AContext.Connection.Connected then
      begin
        PeerIP := Connection.Socket.Binding.PeerIP;
      end;
    end;
  end;
  </code></pre>
  
  <p>Maybe like <code>ClientID := Connection.Socket.Binding.Handle;</code></p>
  
  <pre><code>procedure TForm1.IdTCPServer1Disconnect(AContext: TIdContext);
  begin
   //Connection.Socket.Binding.Handle; ?? 
  end;
  </code></pre>