test_client.py 736 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. # GNU General Public License
  2. # This script is for developers of VCStudio. This one is going to simulate the
  3. # VCStudio client. But in a way where you have more control.
  4. # This is a dumb script so deal with it.
  5. import socket
  6. print("What is te IP of the server?")
  7. ip = input("IP: ")
  8. port = 64646
  9. sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  10. sock.connect((ip, port))
  11. # Now let's talk to the server
  12. while True:
  13. # Simple cycle of receive / write
  14. # RECIEVE
  15. data = sock.recv(1024)
  16. data = data.decode('utf8')
  17. print(data)
  18. # WRITE
  19. message = input(">>> ")
  20. if message == "exit":
  21. exit()
  22. message = bytes(message, 'utf-8')
  23. sock.sendall(message)