#std libs import time import socket import array #my libs import info import updateDDNS import checkNet from TS_handler import TS import TS_handler lb = socket.gethostname() try: ts = TS() ts._listener = TS_handler.Listener(6972) ts.externalIp = 6972 #ts._status = TS_handler.ONLINE ts.go(lb, 6970) except KeyboardInterrupt as e: print() try: ts.terminate() print("Terminated") except Exception as e: print(str(e.with_traceback(None).args))
#std libs import time import socket #my libs import info import updateDDNS import checkNet from TS_handler import TS import TS_handler lb = socket.gethostname() try: ts = TS() ts._listener = TS_handler.Listener() # ts.externalIp = 6970 # ts._status = TS_handler.ONLINE ts.go() except KeyboardInterrupt as e: print() try: ts.terminate() print("Terminated") except Exception as e: print(str(e.with_traceback(None).args))
# ve se ha net # while not checkNet.check(): # print("Checking for net in 5 sec's.") # time.sleep(5) # Update ddns #updateDDNS.update('1.2.3.6') # # raw_msg = (7).to_bytes(1, byteorder=sys.byteorder) + (10).to_bytes(1, byteorder=sys.byteorder) # print(raw_msg) print(time.time()) exit() ts = TS() host1 = (socket.gethostname(), 6970) host2 = (socket.gethostname(), 6971) sock1 = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) sock1.bind(host1) sock2 = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) sock2.bind(host2) rheader = TS_handler.Msg(mode=TS_handler.MsgToRaw, size=0, type=TS_handler.ALIVE, count=1, id=2).getRawHeader() sock1.sendto(rheader, (socket.gethostname(), info.port)) ts.go()