|
|
@ -1,12 +1,13 @@ |
|
|
|
import asyncio |
|
|
|
import argparse |
|
|
|
import asyncio |
|
|
|
import signal |
|
|
|
import threading |
|
|
|
|
|
|
|
from http.server import HTTPServer, SimpleHTTPRequestHandler |
|
|
|
|
|
|
|
import socketio |
|
|
|
|
|
|
|
from .decorator import register_service |
|
|
|
from .get_ip import get_ip_address |
|
|
|
import socketio |
|
|
|
|
|
|
|
sio = socketio.AsyncClient() |
|
|
|
|
|
|
@ -99,10 +100,17 @@ def exit_handler(sig, frame): |
|
|
|
# except (KeyboardInterrupt, asyncio.exceptions.CancelledError): |
|
|
|
# print("Cleaning up and shutting down...") |
|
|
|
|
|
|
|
|
|
|
|
def start_client(host_ip="0.0.0.0", host_port=4999): |
|
|
|
@register_service(name="test client", ip=get_ip_address(), port=13373, host_ip=host_ip, host_port=host_port) |
|
|
|
@register_service( |
|
|
|
name="test client", |
|
|
|
ip=get_ip_address(), |
|
|
|
port=13373, |
|
|
|
host_ip=host_ip, |
|
|
|
host_port=host_port, |
|
|
|
) |
|
|
|
def server(port=13373): |
|
|
|
httpd = HTTPServer(('', port), SimpleHTTPRequestHandler) |
|
|
|
httpd = HTTPServer(("", port), SimpleHTTPRequestHandler) |
|
|
|
print(f"Serving HTTP on 0.0.0.0 port {port} (http://0.0.0.0:{port}/) ...") |
|
|
|
|
|
|
|
def serve_forever_nonblocking(): |
|
|
@ -121,7 +129,6 @@ def start_client(host_ip="0.0.0.0", host_port=4999): |
|
|
|
signal.signal(signal.SIGINT, exit_handler) |
|
|
|
signal.signal(signal.SIGTERM, exit_handler) |
|
|
|
|
|
|
|
|
|
|
|
try: |
|
|
|
server_thread = server() |
|
|
|
asyncio.run(main(host_ip, host_port)) |
|
|
|