def user_input(): global terminate global cmd while True: time.sleep(10) tLock.acquire() uInput = input("Enter: ") if(uInput == "1"): terminate = 1 break if uInput == "2": mySock.mysend(cmd.getShutdown()) if uInput == "3": mySock.mysend(cmd.getStartUp()) if uInput == "4": mySock.mysend(cmd.getReset()) tLock.release()
tLock.acquire() mySock = MySocket() mySock.connect() tLock.release() s1 = threading.Thread(target=user_input) s1.start() while(1): if mySock.dataCheck(): tLock.acquire() incoming = mySock.myreceive() if len(incoming) > 0: print("Incoming: ", incoming) tLock.release() out = cmd.parse(incoming) if len(out) > 0: tLock.acquire() mySock.mysend(out) tLock.release() if(terminate): break
if mySock.dataCheck():
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)