From 3cc18b158288904413225e75d53087f949d476be Mon Sep 17 00:00:00 2001 From: DJ2LS <75909252+DJ2LS@users.noreply.github.com> Date: Thu, 31 Dec 2020 10:12:16 +0100 Subject: [PATCH 1/4] option to send N random numbers ./socketclient.py --port 3000 --random 0 --- socketclient.py | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/socketclient.py b/socketclient.py index f4106962..37141c73 100644 --- a/socketclient.py +++ b/socketclient.py @@ -9,30 +9,57 @@ Created on Fri Dec 11 21:53:35 2020 import socket import sys import argparse +import random +#https://www.askpython.com/python/examples/generate-random-strings-in-python +def create_string(length): + random_string = '' + for _ in range(length): + # Considering only upper and lowercase letters + random_integer = random.randint(97, 97 + 26 - 1) + flip_bit = random.randint(0, 1) + # Convert to lowercase if the flip bit is on + random_integer = random_integer - 32 if flip_bit == 1 else random_integer + # Keep appending random characters using chr(x) + random_string += (chr(random_integer)) + print("STR:" + str(random_string)) + return random_string + + + + #--------------------------------------------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) +#parser.add_argument('--data', dest="data", default=False, help="data", type=str) +parser.add_argument('--random', dest="datalength", default=False, help="data", type=int) + + + args = parser.parse_args() +data = create_string(args.datalength) +data = bytes("ACK:" + "!!!--" + data + "--!!!" + "\n", "utf-8") +print(data) HOST, PORT = "localhost", args.socket_port -data = args.data +#data = args.data # Create a socket (SOCK_STREAM means a TCP socket) with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock: # Connect to server and send data sock.connect((HOST, PORT)) - sock.sendall(bytes(data + "\n", "utf-8")) - + #sock.sendall(bytes(data + "\n", "utf-8")) + sock.sendall(data) # Receive data from the server and shut down received = str(sock.recv(1024), "utf-8") print("Sent: {}".format(data)) print("Received: {}".format(received)) + + From 930b46dacd876ead322edde3a26a5d91ecf22b99 Mon Sep 17 00:00:00 2001 From: DJ2LS <75909252+DJ2LS@users.noreply.github.com> Date: Fri, 15 Jan 2021 08:57:32 +0100 Subject: [PATCH 2/4] Changed project name --- README.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 7367d49c..f6c710fd 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ -# FreeDV-Socket-TNC -My first attempt to learn more about FreeDV and how to create a TNC which gets data from a TCP/IP Socket. - - +# FreeDV-JATE +## FreeDV- Just Another TNC Experiment +My first attempt to learn more about FreeDV and how to create a TNC which gets data from a TCP/IP socket ## Credits From 0c1179211a1011393a7fc706b5f2e35b9fc74b9f Mon Sep 17 00:00:00 2001 From: DJ2LS <75909252+DJ2LS@users.noreply.github.com> Date: Sat, 16 Jan 2021 09:28:37 +0100 Subject: [PATCH 3/4] updated new repository name --- install_socket_tnc.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/install_socket_tnc.sh b/install_socket_tnc.sh index 732d5871..500002e2 100644 --- a/install_socket_tnc.sh +++ b/install_socket_tnc.sh @@ -1,11 +1,11 @@ #/bin/bash cd ~ -rm -rf FreeDV-Socket-TNC -git clone --branch dev https://github.com/DJ2LS/FreeDV-Socket-TNC.git +rm -rf FreeDV-JATE +git clone --branch dev https://github.com/DJ2LS/FreeDV-JATE.git -cd ~/FreeDV-Socket-TNC +cd ~/FreeDV-JATE rm -rf codec2 git clone https://github.com/drowe67/codec2.git cd codec2 && mkdir build_linux && cd build_linux @@ -13,14 +13,14 @@ cmake ../ make -cd ~/FreeDV-Socket-TNC +cd ~/FreeDV-JATE rm -rf LPCNet git clone https://github.com/drowe67/LPCNet cd LPCNet && mkdir build_linux && cd build_linux -cmake -DCODEC2_BUILD_DIR=~/FreeDV-Socket-TNC/codec2/build_linux ../ +cmake -DCODEC2_BUILD_DIR=~/FreeDV-JATE/codec2/build_linux ../ make cd ~/FreeDV-Socket-TNC/codec2/build_linux && rm -Rf * -cmake -DLPCNET_BUILD_DIR=~/FreeDV-Socket-TNC/LPCNet/build_linux .. +cmake -DLPCNET_BUILD_DIR=~/FreeDV-JATE/LPCNet/build_linux .. make From 37fe2e024c6846f8936334404083c93e15ed1711 Mon Sep 17 00:00:00 2001 From: DJ2LS <75909252+DJ2LS@users.noreply.github.com> Date: Sat, 16 Jan 2021 09:29:17 +0100 Subject: [PATCH 4/4] Rename install_socket_tnc.sh to install_jate.sh --- install_socket_tnc.sh => install_jate.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename install_socket_tnc.sh => install_jate.sh (100%) diff --git a/install_socket_tnc.sh b/install_jate.sh similarity index 100% rename from install_socket_tnc.sh rename to install_jate.sh