title: recv() in Python
body: <pre><code>open_sockets = []
  
  listening_socket = socket.socket( socket.AF_INET, socket.SOCK_STREAM )
  
  listening_socket.bind( ("", 1234) )
  
  listening_socket.listen(5)
  
  while True:
      rlist, wlist, xlist = select.select( [listening_socket] + open_sockets, [], [] )
      for i in rlist:
          if i is listening_socket:
              new_socket, addr = listening_socket.accept()
              open_sockets.append(new_socket)
          else:
              data = i.recv(1024)
              if data == "":
                  i.close()
                  open_sockets.remove(i)
                  print "Connection closed"
              else:
                  i.send(data)
                  print repr(data)
  </code></pre>
  
  <p>Now I know this is simple server code that can handle a few clients - the only thing that I don't understand are these two lines:</p>
  
  <pre><code>        data = i.recv(1024)
          if data == "":
  </code></pre>
  
  <p>I understand that when the client has already accepted it will go to the other option, the option that checks if there is something in the buffer. I didn't understand why, when there is nothing in the buffer, it goes on and doesn't check the line:</p>
  
  <pre><code>if data == "":
  </code></pre>
  
  <p>but when the client just presses enter which is equivalent to <code>""</code> it disconnects</p>
  
  <p>Why when nothing is pressed it is not the same as <code>""</code>? </p>