Difficult-Rocket/bin/server.py

35 lines
949 B
Python
Raw Normal View History

2021-02-22 21:32:13 +08:00
"""
2021-01-21 15:05:29 +08:00
writen by shenjackyuanjie
mail: 3695888@qq.com
2021-02-22 21:32:13 +08:00
"""
2021-01-21 15:05:29 +08:00
2021-02-22 21:32:13 +08:00
import os
2021-01-21 15:05:29 +08:00
import multiprocessing as mp
2021-02-22 21:32:13 +08:00
try:
from bin import tools
except (ModuleNotFoundError, ImportError, ImportWarning):
import tools
2021-01-21 15:05:29 +08:00
2021-01-23 19:55:35 +08:00
class server(mp.Process):
2021-02-21 11:58:47 +08:00
def __init__(self, dev_list, dev_dic, logger, language='zh-cn', net_mode='local'):
2021-01-21 15:05:29 +08:00
# father class __init__()
mp.Process.__init__(self)
2021-01-25 12:22:55 +08:00
# logging
self.logger = logger
2021-01-21 15:05:29 +08:00
# value
2021-01-23 19:55:35 +08:00
self.process_id = 'Server'
self.process_name = 'server process'
2021-02-22 21:32:13 +08:00
self.process_pid = os.getpid()
# lang
self.lang = tools.config('sys_value/lang/%s.json5' % language, 'server')
2021-01-25 07:32:39 +08:00
# share memory
2021-01-21 15:05:29 +08:00
self.dev_list = dev_list
self.dev_dic = dev_dic
2021-02-26 19:05:24 +08:00
self.logger.info('%s: %s %s' % (self.lang['os.pid_is1'], self.process_pid, self.lang['os.pid_is2']))
2021-02-22 21:32:13 +08:00
self.logger.info('%s' % self.lang['setup.done'])
2021-01-21 15:05:29 +08:00
def run(self):
pass