title: Client/Server in Python
body: <p>I tried to implement a communication between server and client in python. I need to send a message between them, bidirectional , but I don't know how to make it as a continuous communication, because in my programm connection is closed after server and client sent only a message. Can anybody help me?</p>
  <p>This is my code for server :</p>
  <pre><code>import socket
  
  serv = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  
  serv.bind(('0.0.0.0', 8082))
  serv.listen(5)
  
  while True:
      conn, addr = serv.accept()
      from_client=''
      while True:
          from_client=''
          data = conn.recv(4096)
          if not data : break
          from_client+=data
          print from_client
      
          print(&quot;Send character to CLIENT &quot;)
          input1=str(raw_input())
          conn.send(input1)
      
          print(&quot;You received from client the next Character&quot;)
          from_client=''
          data = conn.recv(4096)
          if not data : break
          from_client+=data
          print from_client
          print'\n'
     conn.close()
     print 'client disconenct'
  </code></pre>
  <p>This is my code for client :</p>
  <pre><code>import socket
  
  client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  client.connect(('0.0.0.0', 8082))
  
  client.send(&quot;I am CLIENT\n&quot;)
  from_server = client.recv(4096)
  print(&quot;I received from SERVER %s&quot; %from_server)
  print(&quot;Send your character to SERVER&quot;)
  input1=str(raw_input())
  client.send(input1)
  
  client.close()
  </code></pre>