title: Problem with socket.settimeout() function where it ignores the value entered by me
body: <p>me and my friend were trying to build a real time text editor project using python.</p>
  <p>We first encountered the problem when we thought about making the client wait a certain amount (30 seconds) on connect().</p>
  <p>We used settimeout(30.0) on the main pc we are coding but the function always ends the timeout after 2.1 seconds exactly. However, after using print(client.gettimeout()) it prints 30.0 as expected.</p>
  <p>We then took THE SAME CODE to another pc and after running the file  we see that it prints 30.0 as the other pc. BUT, the timeout ends after 21.1 seconds exactly.</p>
  <p>So my question is ... why does the same code behaves differently on different pcs? and how do I fix this problem and make the timeout actually waits the whole 30 seconds.</p>
  <pre><code>import socket
  
  PORT = 5050
  
  SERVER = &quot;192.168.1.101&quot;
  ADDR = (SERVER, PORT)
  to = 30.0
  
  def ourThread():
          
      client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
      connected = False
      client.settimeout(30.0)
  
      while not connected:
          
          try:
              print(&quot;1&quot;)
              client.connect(ADDR)
             
          except:
              print(&quot;3&quot;)
  
          else:
              print(&quot;connected&quot;)
              client.settimeout(None)
  </code></pre>
  <p>The output of this code is:</p>
  <p>1</p>
  <p>3 (after 21.1 seconds)</p>
  <p>1</p>
  <p>3 (after another 21.1 seconds)</p>
  <p>and so on..</p>