title: Python Server-Client Communication with each other
body: <p>I am trying to modify a tcp/ip server-client communication. Only the server can communicate with the client. I am trying to find an easy a way to send a message back to the server. Not a chat !! Just a server which will send data to a client and receive data from the client. </p>
  
  <p>I am using this example :</p>
  
  <p>Server:</p>
  
  <pre><code>    host="my_ip"
      port=4446                  
      from socket import *              
      s=socket()
      s.bind((host,port))                 
      s.listen(1)                         
      print "Listening for connections.. "
      q,addr=s.accept()               
      var = 1
      while var == 1 :
           data=raw_input("Enter data to be send:  ")  
           q.send(data)  
      s.close()
  </code></pre>
  
  <p>Client:</p>
  
  <pre><code>    host="my_ip"
      port=4446 
      from socket import *
      s=socket(AF_INET, SOCK_STREAM)
      s.connect((host,port))
      var = 1
      while var == 1 :  
           msg=s.recv(1024)
           print "Message from server : " + msg
           #response = "Message delivered"   # Response to be send 
           #s.sendto(response(host,port)) 
      s.close()
  </code></pre>