# coding: utf8 import os import time import socket from subprocess import Popen from openui import openui HOST = '0.0.0.0' PORT = 20127 # CWD = r'..\client\platform\mingw\build' CWD = r'build' BIN = r'lr.exe' def main(): s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) s.bind((HOST, PORT)) print 'waiting on port:', PORT while 1: data, addr = s.recvfrom(1024) if len(data) < 512 and data.startswith('hydrarnan:'): print time.strftime('%Y-%m-%d %H:%M:%S'), '**** recv command ****' head, body = data.strip().split(':', 1) print body openui(body) else: print time.strftime('%Y-%m-%d %H:%M:%S'), 'ERROR' print data os.system('pause') if __name__ == '__main__': main()