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

17 lines
375 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)))
bys = json.dumps({"response" : "ppoop"})
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()