title: My simple client crash everytime it tries to connect to my python socket server
body: <p>My client crash everytime it tries to connect to my python socket server. I dont know why but but my server seams to start up fine then when i start up my client it establishes a connection to the server but it crash direct. Im doing almost as what they say in <a href="https://docs.python.org/3.4/library/socket.html" rel="nofollow">py socket docs</a> so im wondering if i have missed something or just staring blindly on something easy. Could any one help pls im using python3.4.</p>
  
  <p>server.py</p>
  
  <pre><code>import socket 
  
  host = ''
  port = 1010
  
  s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 
  s.bind((host, port)) 
  s.listen(1) 
  conn, addr = s.accept() 
  print ("Connection from", addr) 
  while True: 
      databytes = conn.recv(1024)
      if not databytes: break
      print("Recieved: "+(databytes.decode('utf-8')))
      response = input("Reply: ") 
      if response == "exit": 
          break
      conn.sendall(response.encode('utf-8')) 
  conn.close()
  </code></pre>
  
  <p>client.py</p>
  
  <pre><code>import socket 
  
  host = '127.0.0.1'
  port = 1010 
  
  s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 
  s.connect((host, port)) 
  print("Connected to "+(host)+" on port "+str(port)) 
  initialMessage = input("Send: ") 
  s.sendall(initialMessage.encode('utf-8'))  
  
  while True: 
   data = s.recv(1024) 
   print("Recieved: "+(data.decode('utf-8')))
   response = input("Reply: ") 
   if response == "exit": 
       break
   s.sendall(response.encode('utf-8')) 
  s.close()
  </code></pre>