title: Basic Python TCP Socket Server & Client
body: <p>My first question here, please be gentle :)  I'm trying to setup a basic Python (2.7) TCP socket server that is multithreaded (I haven't got to the multithreaded part yet), and a client.  </p>
  
  <p>Here is the server:</p>
  
  <pre><code># Basic TCP socket server
  
  import socket
  
  s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  
  host = ''
  port = 8888
  
  s.bind((host, port))
  s.listen(5)
  
  while True:
      c, addr = s.accept()
      print("Connected to %s" % addr)
      c.send("Hello socket")
      c.close()    
  </code></pre>
  
  <p>And here is the client:</p>
  
  <pre><code># Basic TCP socket client
  
  import socket
  
  s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  
  host = '127.0.0.1'
  port = 8888
  
  s.connect((host, port))
  print s.recv(1024)
  
  s.close()
  </code></pre>
  
  <p>When I run the server it seems to execute without errors, but when I run the client to connect, I don't see the message that should be printed out to my terminal window where server is running.  Here is the error (as @Rawing pointed out):</p>
  
  <blockquote>
    <p>Traceback (most recent call last):   File "server.py", line 19, in
    
        print("Connected to %s" % addr) TypeError: not all arguments converted during string formatting</p>
  </blockquote>
  
  <p>As far as making the server multithreaded, I need to read up on that but any suggestions are welcome.</p>
  
  <p>Thank You.</p>