title: Python Socket not sending data
body: <p>I'm currently working on a login server that can return user data to a computer that requests it. However it is not sending any data at all. Here are the parts of the code I think may be causing errors:</p>
  
  <p><strong>Server</strong></p>
  
  <pre><code>s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  s.bind(('127.0.0.1', 4876))
  s.listen(1)
  conn, addr = s.accept()
  
  print('Connected: ' + addr[0])
  
  data = conn.recv(1024)
  print(addr[0] + ': ' + data)
  data = data.split(' ')
  
  if data[0] == 'rquser':
      print(addr[0] + ' requested user ' + data[1])
      users = open(read_settings()['local']['user_file'], 'r')
      users = json.load(users)
      user_found = (False, 0)
      print(addr[0] + ': searching... ')
      for x in range(len(users)):
          if users[str(x)]['username'] == data[1]:
              user_found = (True, x)
              break
  
      if user_found[0]:
          print(addr[0] + ': User found. ')
          conn.sendall(users[user_found[1]])
          conn.close()
  </code></pre>
  
  <p><strong>Client</strong></p>
  
  <pre><code>try:
      if read_settings()['local_users']:
          us = open(read_settings()['local']['user_file'], 'r')
          return json.load(us)
      else:
          if uid is None:
              raise ValueError
          else:
              s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
              s.connect((read_network_settings()['server_ip'], 4876))
              message = 'rquser ' + uid
              s.sendall('rquser ' + uid)
  
              s_recv = ''
              data = s.recv(64)
              while True:
                  data = s.recv(64)
                  s_recv += data
                  if not data:
                      break
              s.close()
              return s_recv
  except IOError, socket.error:
      return None
  </code></pre>
  
  <p>I have made the server print out the status but it seems to stop at <code>Connected: 127.0.0.1</code>
  I'm new to sockets in python and I've had little success with projects. But this one I can't understand why it's not working</p>