Skip to content

Commit

Permalink
#267 Added test script, felt cute, might delete later
Browse files Browse the repository at this point in the history
  • Loading branch information
lxgr-linux committed May 1, 2023
1 parent 0abc780 commit 5693c6e
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .vim/coc-settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"python.linting.pylintEnabled": true,
"python.linting.enabled": true
}
35 changes: 35 additions & 0 deletions server/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import socket, time, json, sys

HOST = "localhost" # The server's hostname or IP address
PORT = 9988 # The port used by the server

with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
s.connect((HOST, PORT))
response = {
"Type": 1,
"Body": {
"UserName": sys.argv[1],
"Version": "0.9.1"
}
}
s.sendall(str.encode(json.dumps(response)))
while True:
data = s.recv(1048576)
print(data)
time.sleep(1)
#print(f"Received {json.dumps(json.loads(data), indent=4)}")
s.sendall(str.encode(json.dumps({
"Type": 0,
"Body": {
"X": 4,
"Y": 5,
}
})))
s.sendall(str.encode(json.dumps({
"Type": 0,
"Body": {
"X": 5,
"Y": 5,
}
})))
time.sleep(1)

0 comments on commit 5693c6e

Please sign in to comment.