title: How do I test if there is a server open on a port with python?
body: <p>Ok, so I did the following, figuring it would raise an exception if it could not connect:</p>
  
  <pre><code>&gt;&gt;&gt; s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  &gt;&gt;&gt; s.settimeout(0.2)
  &gt;&gt;&gt; s.connect(("thisdomaiyndontexistduhh.com", 80))
  </code></pre>
  
  <p>But no exception was raised. How do I test if there is a server open on a port with Python's socket module? Thanks!</p>