title: Check if a Client is Still Connected - Python Socket Programming using UDP
body: <p>Im currently developing a  chat application using UDP. How will I tell if the client is still connected to my server or still running? Below is my code:</p>
  
  <pre><code> for i, addr in enumerate(self.all_addresses):    
          try:               
              self.socket.sendto(str.encode(''), ('&lt;broadcast&gt;', int(addr[1])))
  
  
          except e:              
              del self.all_addresses[i]
              continue
  </code></pre>
  
  <p>self.all_addresses contains the ip and port of the clients binded to the server. In the code above, I was testing whether if I send blank message to the client and it doesn't throw error, then it means it still connected. Unfortunately, the code is not working, even if the client is not running anymore, the code doesn't throw an exception. Please help me with my problem. thanks.</p>