22 lines
634 B
Python
22 lines
634 B
Python
import argparse
|
|
import threading
|
|
from src.communication import ServiceExplorationModule
|
|
from src.parser import get_args
|
|
|
|
if __name__ == '__main__':
|
|
args = get_args()
|
|
|
|
socket_type = args.type
|
|
host, port = args.host, args.port
|
|
|
|
# start Service Exploration Module
|
|
# let all client can know which IP address has our service so that it can link to.
|
|
service_explore = ServiceExplorationModule(host, port+1)
|
|
explore_service_thread = threading.Thread(target=service_explore.listen)
|
|
explore_service_thread.start()
|
|
|
|
if socket_type == 'client':
|
|
hosts = service_explore.explore()
|
|
print(hosts)
|
|
|