title: Creating non-blocking socket in python
body: <p>I was trying to understand how non-blocking sockets work ,so I wrote this simple server in python .</p>
  
  <pre><code>import socket
  
  s=socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  
  s.bind(('127.0.0.1',1000))
  s.listen(5)
  s.setblocking(0)
  while True:
        try:
              conn, addr = s.accept()
              print ('connection from',addr)
              data=conn.recv(100)
              print ('recived: ',data,len(data))
  
        except:
            pass  
  </code></pre>
  
  <p>Then I tried to connect to this server from multiple instances of this client</p>
  
  <pre><code>import socket
  
  s=socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  s.connect(('127.0.0.1',1000))
  while True:
      continue
  </code></pre>
  
  <p>But for some reason putting blocking to 0 or 1 dose not seem to have an effect and server's recv method always block the execution.
  So, dose creating non-blocking socket in python require more than just setting the blocking flag to 0.</p>