1
0
Fork 0
mirror of https://github.com/besterprotocol/besterd synced 2023-12-13 21:00:32 +01:00
besterd/testing/unixSock.py

21 lines
504 B
Python
Raw Normal View History

2020-04-18 16:43:42 +02:00
import socket
import json
2020-04-18 16:43:42 +02:00
def runTest():
d=socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
d.bind("../aSock")
d.listen()
2020-04-18 19:30:43 +02:00
while True:
s = d.accept()[0]
print(list(s.recv(130)))
2020-04-19 16:51:04 +02:00
bys = json.dumps({
"header" : {
2020-04-19 18:53:16 +02:00
"status" : "0",
"command" : {"type" : "sendClients", "data": ["tbk", "tbk"]}
2020-04-19 16:51:04 +02:00
} })
print(s.send(bytes([len(bys),0,0,0])))
print(s.send(bys.encode()))
2020-04-18 16:43:42 +02:00
while True: pass
runTest()