# GNU General Public License # This script is for developers of VCStudio. This one is for reading messages. import sys import datetime # Fisrt we need to know what mode are we testing. print(" VCStudio Read Messages.") print(" Modes: r [Render], m [Multiuser]") if len(sys.argv) > 2: mode = sys.argv[2] print("Mode: "+mode) else: mode = input("Mode: ") import socket if mode == "r": UDP_IP = "127.0.0.1" UDP_PORT = 54545 elif mode == "m": UDP_IP = "255.255.255.255" UDP_PORT = 54545 else: print("There is no mode: "+mode) exit() prev = "" while True: try: sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) sock.bind((UDP_IP, UDP_PORT)) sock.settimeout(0.05) data, addr = sock.recvfrom(1024) data = data.decode('utf8') seconds_format = "%H:%M:%S" time = datetime.datetime.strftime(datetime.datetime.now(), seconds_format) if prev != str(data): print(time+" | "+str(data)) prev = str(data) sock.close() except: pass