added cli paramters

This commit is contained in:
DJ2LS 2020-12-23 18:31:09 +01:00 committed by GitHub
parent 17294069c9
commit d5bf540aea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -8,9 +8,22 @@ Created on Fri Dec 11 21:53:35 2020
import socket
import sys
import argparse
HOST, PORT = "localhost", 3000
data = " ".join(sys.argv[1:])
#--------------------------------------------GET PARAMETER INPUTS
parser = argparse.ArgumentParser(description='Simons TEST TNC')
parser.add_argument('--port', dest="socket_port", default=9000, help="Set the port, the socket is listening on.", type=int)
parser.add_argument('--data', dest="data", default=False, help="data", type=str)
args = parser.parse_args()
HOST, PORT = "localhost", args.socket_port
data = args.data
# Create a socket (SOCK_STREAM means a TCP socket)
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock: