Server/Client continuous connection in python? (Python 3x)
Question: Hi everyone this is my firs post here and I have a question about python
server/client continuous connection where I can write as a client and comes
back to the server, and it shouldn't stop till i type "end".

> **This is my server:**
    
    
    from socket import *
    def main():
      s=socket(AF_INET, SOCK_STREAM)
      s.bind((' ', 10530))
      s.listen(1)
      conn, (rmip, rmpt) = s.accept()
      while 1:
        print ("Connected by ", str(rmip)+": " +str(rmpt))
        data = conn.recv(1024)
        print ("What was delivered: ", data.decode())
        if not data:
          break
      conn.close()
    main()
    

> **This si my client:**
    
    
    from socket import *
    def main():
      s = socket(AF_INET, SOCK_STREAM)
      s.connect(('localhost',10530))
      sendme = input("What do you want to send\n")
      s.send(sendme.encode())
    main()
    

Now all I want is this connection to continue so I can write something else
again and again client-server, until the client ends the connection, [Like
shown in the picture here](http://i.stack.imgur.com/KWGwN.jpg)

Thank you very much for help! :)


Answer: You have a `while` loop in your server which keeps going until an empty
payload is received. You don't have any looping construct in your client,
however, so it will exit after one message.

Add a loop to your client as well, and check for an input of `end`, at which
point you can break out of the loop.

