mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
cleanup
This commit is contained in:
parent
4e3d2cc158
commit
829692a13d
1 changed files with 4 additions and 46 deletions
48
main.py
48
main.py
|
@ -16,42 +16,6 @@ import static
|
||||||
import helpers
|
import helpers
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def start_cmd_socket():
|
|
||||||
|
|
||||||
try:
|
|
||||||
logging.info("SRV | STARTING TCP/IP CMD ON PORT: " + str(static.PORT))
|
|
||||||
socketserver.TCPServer.allow_reuse_address = True #https://stackoverflow.com/a/16641793
|
|
||||||
cmdserver = socketserver.TCPServer((static.HOST, static.PORT), sock.CMDTCPRequestHandler)
|
|
||||||
cmdserver.serve_forever()
|
|
||||||
|
|
||||||
finally:
|
|
||||||
cmdserver.server_close()
|
|
||||||
|
|
||||||
|
|
||||||
def start_data_socket():
|
|
||||||
|
|
||||||
try:
|
|
||||||
logging.info("SRV | STARTING TCP/IP DATA ON PORT: " + str(static.PORT + 1))
|
|
||||||
socketserver.TCPServer.allow_reuse_address = True #https://stackoverflow.com/a/16641793
|
|
||||||
dataserver = socketserver.TCPServer((static.HOST, static.PORT + 1), sock.DATATCPRequestHandler)
|
|
||||||
dataserver.serve_forever()
|
|
||||||
|
|
||||||
finally:
|
|
||||||
dataserver.server_close()
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
||||||
# config logging
|
# config logging
|
||||||
|
@ -86,7 +50,7 @@ if __name__ == '__main__':
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
|
||||||
|
#--------------------------------------------START CMD & DATA SERVER
|
||||||
static.FREEDV_DATA_MODE = args.freedv_data_mode
|
static.FREEDV_DATA_MODE = args.freedv_data_mode
|
||||||
static.AUDIO_INPUT_DEVICE = args.audio_input_device
|
static.AUDIO_INPUT_DEVICE = args.audio_input_device
|
||||||
static.AUDIO_OUTPUT_DEVICE = args.audio_output_device
|
static.AUDIO_OUTPUT_DEVICE = args.audio_output_device
|
||||||
|
@ -94,16 +58,10 @@ if __name__ == '__main__':
|
||||||
|
|
||||||
import sock # we need to wait until we got all parameters from argparse
|
import sock # we need to wait until we got all parameters from argparse
|
||||||
|
|
||||||
|
cmd_server_thread = threading.Thread(target=sock.start_cmd_socket, name="cmd server")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#--------------------------------------------START CMD & DATA SERVER
|
|
||||||
|
|
||||||
cmd_server_thread = threading.Thread(target=start_cmd_socket, name="cmd server")
|
|
||||||
cmd_server_thread.start()
|
cmd_server_thread.start()
|
||||||
|
|
||||||
data_server_thread = threading.Thread(target=start_data_socket, name="data server")
|
data_server_thread = threading.Thread(target=sock.start_data_socket, name="data server")
|
||||||
data_server_thread.start()
|
data_server_thread.start()
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue