Exemple #1
0
        def __init__(self, console, key_val):
                global server_dict
                pp_thread.__init__(self, 'udp_worker')

                self.console     = console
                self.event_shot  = None
                self.price_shot  = 0

                self.list_trigger_time  = None
                self.list_trigger_event = None

                self.udp_format  = None

                self.bidno       = key_val['bidno']
                self.pid         = key_val['pid']
                self.group       = key_val['group']

                self.server_addr = server_dict[self.group]['udp']['ip'], server_dict[self.group]['udp']['port']

                self.sock        = socket(AF_INET, SOCK_DGRAM)
                self.sock.settimeout(self.udp_timeout)
                self.sock.bind(('',0))
                logger.info('Client %s : login bind udp_sock @%s ' % (self.bidno, self.sock.getsockname()))

                self.proto       = udp_proto()
Exemple #2
0
def save_dump():
    global db_name, database
    try:
        f = open(db_name, 'wb')
        dump(database, f, 4)
        f.close()
        logger.info('DataBase Saved')
        print(database.db)
    except:
        print_exc()
Exemple #3
0
def load_dump():
    global db_name, database
    try:
        f = open(db_name, 'rb')
        database = load(f)
        f.close()
        logger.info('DataBase Loaded')
        print(database.db)
    except FileNotFoundError:
        database.db = {}
        logger.info('DataBase Created')
    except:
        print_exc()
Exemple #4
0
def pp_main():
    logger.info('Client Started ...')
    pp_init_tk()