send_messages.py 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. # GNU General Public License
  2. # This script is for developers of VCStudio. This one is sending test messages.
  3. import socket
  4. import time
  5. import sys
  6. # Fisrt we need to know what mode are we testing.
  7. print(" VCStudio Send Test Messages.")
  8. print(" Modes: r [Render], m [Multiuser]")
  9. if len(sys.argv) > 2:
  10. mode = sys.argv[2]
  11. print("Mode: "+mode)
  12. else:
  13. mode = input("Mode: ")
  14. import socket
  15. if mode == "r":
  16. UDP_IP = "127.0.0.1"
  17. UDP_PORT = 54545
  18. elif mode == "m":
  19. UDP_IP = "255.255.255.255"
  20. UDP_PORT = 54545
  21. else:
  22. print("There is no mode: "+mode)
  23. exit()
  24. prev = ""
  25. while True:
  26. message = input(">>> ")
  27. if message == "exit":
  28. break
  29. for i in range(500):
  30. cs1 = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
  31. cs1.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
  32. cs1.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
  33. #message = "["+str(i)+"]TEST VCStudio rendering"
  34. cs1.sendto(bytes(message, 'utf-8'), (UDP_IP, UDP_PORT))
  35. #print(message)