Skip to content

Commit 1180575

Browse files
authored
Merge pull request #55 from JE-Chen/dev
add data send protocol
2 parents 303826e + 0d7880e commit 1180575

File tree

4 files changed

+30
-20
lines changed

4 files changed

+30
-20
lines changed

.idea/workspace.xml

Lines changed: 18 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dev_setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
setuptools.setup(
77
name="je_auto_control_dev",
8-
version="0.0.38",
8+
version="0.0.39",
99
author="JE-Chen",
1010
author_email="zenmailman@gmail.com",
1111
description="auto testing",

je_auto_control/utils/socket_server/auto_control_socket_server.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
1+
import argparse
12
import json
23
import socketserver
4+
import sys
35
import threading
46

5-
from je_auto_control import execute_action
7+
from je_auto_control.utils.executor.action_executor import execute_action
68

79

810
class TCPServerHandler(socketserver.BaseRequestHandler):
911

1012
def handle(self):
1113
command_string = str(self.request.recv(8192).strip(), encoding="utf-8")
14+
socket = self.request
1215
print("command is: " + command_string, flush=True)
1316
if command_string == "quit_server":
1417
self.server.shutdown()
@@ -17,7 +20,11 @@ def handle(self):
1720
else:
1821
try:
1922
execute_str = json.loads(command_string)
20-
execute_action(execute_str)
23+
for execute_function, execute_return in execute_action(execute_str).items():
24+
socket.sendto(str(execute_return).encode("utf-8"), self.client_address)
25+
socket.sendto("\n".encode("utf-8"), self.client_address)
26+
socket.sendto("Return_Data_Over_JE".encode("utf-8"), self.client_address)
27+
socket.sendto("\n".encode("utf-8"), self.client_address)
2128
except Exception as error:
2229
print(repr(error))
2330

@@ -36,3 +43,4 @@ def start_autocontrol_socket_server(host: str = "localhost", port: int = 9938):
3643
server_thread.start()
3744
return server
3845

46+

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
setuptools.setup(
77
name="je_auto_control",
8-
version="0.0.104",
8+
version="0.0.105",
99
author="JE-Chen",
1010
author_email="zenmailman@gmail.com",
1111
description="auto testing",

0 commit comments

Comments
 (0)