title: Read list - select() - what's going there? (Python 2.6)
body: <p>I'm trying to create a connection between a server to many clients using select.
  I have tried this only with one client, but after he connects (works fine), the client tries to send his username and the server tries to recieve it, but an error in the server says that the connection was forcely closed by the client. Does anybody knows why? </p>
  
  <p>EDIT: I've done some changes in my code but I still have a similar problem.. here it is:</p>
  
  <p>Server:</p>
  
  <pre><code>global players
  players = {}
  global players_sockets
  players_sockets = []
  while True:
      rlist, wlist, xlist = select.select([server_socket] + players_sockets, players_sockets, [], 0.3)
      print rlist
      for current_socket in rlist:
          if current_socket is server_socket:
              ((new_socket, address)) = server_socket.accept()
              players_sockets.append(new_socket) 
          else:
              msg = current_socket.recv(1024)
              if msg == '':
                  players_sockets.remove(current_socket)
                  del players[get_key_from_dict(players, value)]
              else:
                  players[msg] = current_socket
  </code></pre>
  
  <p>(When msg == '', client quits; Else it he's username)</p>
  
  <p>Client:</p>
  
  <pre><code>while True:
              rlist, wlist, xlist = select.select([my_socket], [my_socket], [], 0.3)
                              print wlist
              if rlist:
                  msg = my_socket.recv(1024)
                  print msg
              if wlist:
                  for message in messages_to_send:
                      my_socket.send(message)
                      print message
                      messages_to_send.remove(message)
              for event in pygame.event.get(): # event handling loop
                  if event.type == QUIT:
                      messages_to_send.append('')
                      pygame.quit()
                      sys.exit()
  </code></pre>