2021-03-01 07:38:28 +00:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
"""
|
|
|
|
Created on Fri Dec 11 21:53:35 2020
|
|
|
|
|
|
|
|
@author: parallels
|
|
|
|
"""
|
|
|
|
|
2023-02-09 12:26:25 +00:00
|
|
|
|
2021-03-01 07:38:28 +00:00
|
|
|
import socket
|
|
|
|
import sys
|
|
|
|
import argparse
|
|
|
|
import time
|
|
|
|
|
2022-05-23 12:26:14 +00:00
|
|
|
# --------------------------------------------GET PARAMETER INPUTS
|
2021-03-01 07:38:28 +00:00
|
|
|
parser = argparse.ArgumentParser(description='Simons TEST TNC')
|
2023-02-09 12:26:25 +00:00
|
|
|
parser.add_argument('--port', dest="socket_port", default=3000, help="Set the port, the socket is listening on.", type=int)
|
2021-03-01 07:38:28 +00:00
|
|
|
parser.add_argument('--data', dest="data", default=False, help="data", type=str)
|
|
|
|
|
|
|
|
args = parser.parse_args()
|
|
|
|
|
|
|
|
ip, port = "localhost", args.socket_port
|
|
|
|
message = args.data
|
|
|
|
|
|
|
|
print(len(b'\n'))
|
|
|
|
|
|
|
|
while True:
|
|
|
|
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
|
|
|
|
|
|
|
|
sock.connect((ip, port))
|
|
|
|
sock.sendall(bytes(message, 'utf-8') + b'\n')
|
|
|
|
response = str(sock.recv(1024), 'utf-8')
|
2023-02-09 12:26:25 +00:00
|
|
|
print(f"CMD: {response}")
|
2021-03-01 07:38:28 +00:00
|
|
|
False
|
|
|
|
break
|