title: Get online clients python sockets
body: <p>I'm making a chat app in python sockets, and I'm trying to print out the online clients</p>
  <pre><code>server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  server.bind((&quot;&quot;, port))
  server.listen(5)
  
  clients = []
  
  while True:
      print(f&quot;Clients connected: {len(clients)}&quot;)
      client, addr = server.accept()
      clients.append(client)
  </code></pre>
  <p>Every time a client connects the number goes up, but if the client disconnects the number stays the same. How can I know when a client is disconnected?</p>