def run(self):
global httpd, ui_player
print('starting server...')
server_address = ('', self.port)
server_start = False
try:
httpd = ThreadedHTTPServer(server_address, testHTTPServer_RequestHandler)
if self.https_allow and self.cert_file:
if os.path.exists(self.cert_file):
httpd.socket = ssl.wrap_socket(
httpd.socket, certfile=self.cert_file,
ssl_version=ssl.PROTOCOL_TLSv1_2)
server_start = True
except:
txt = 'Your local IP changed..or port is blocked\n..Trying to find new IP'
send_notification(txt)
self.ip = get_ip()
txt = 'Your New Address is '+self.ip + '\n Please restart the player'
send_notification(txt)
change_config_file(self.ip, self.port)
server_address = (self.ip, self.port)
self.ui.local_ip = self.ip
#httpd = ThreadedHTTPServer(server_address, testHTTPServer_RequestHandler)
if server_start:
print('running server...at..'+self.ip+':'+str(self.port))
httpd.serve_forever()
else:
print('server..not..started..')
评论列表
文章目录